Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert .net core to .net standard #173

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/FeatureToggle.Shared/Internal/AppSettingsProvider.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETFULL || NETCORE
#if NETFULL || NETSTANDARD

using System;
using System.Collections.Generic;
Expand All @@ -12,7 +12,7 @@
using System.Web.Script.Serialization;
#endif

#if NETCORE
#if NETSTANDARD
using Microsoft.Extensions.Configuration;
using System.IO;
#endif
Expand All @@ -25,7 +25,7 @@ public sealed class AppSettingsProvider : IBooleanToggleValueProvider, IDateTime
private const string KeyNotFoundInAppsettingsMessage = "The key '{0}' was not found in AppSettings";


#if NETCORE
#if NETSTANDARD

IConfigurationRoot _configuration;

Expand Down Expand Up @@ -235,7 +235,7 @@ private string GetConfigValue(string key)
}


#if NETCORE
#if NETSTANDARD
private static string AppDirectory => AppContext.BaseDirectory;
#endif

Expand Down
9 changes: 5 additions & 4 deletions src/FeatureToggle/FeatureToggle.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetFrameworks>net461;uap10.0;netcoreapp1.0;</TargetFrameworks>
<TargetFrameworks>net461;uap10.0;netstandard1.4;</TargetFrameworks>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<Version>4.0.2</Version>
Expand All @@ -18,13 +18,14 @@
<PackageReleaseNotes>For release notes and history see https://github.com/jason-roberts/FeatureToggle/blob/master/Release-Notes.md</PackageReleaseNotes>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
<DefineConstants>NETCORE;NETCOREAPP1_0</DefineConstants>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.4' ">
<DefineConstants>NETSTANDARD</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.4' ">
<PackageReference Include="Microsoft.Extensions.Configuration" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.1" />
<PackageReference Include="System.Net.Requests" Version="4.3.0" />
</ItemGroup>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;DEBUG;NETCOREAPP1_0;NETCORE</DefineConstants>
<DefineConstants>TRACE;DEBUG;NETSTANDARD</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE;RELEASE;NETCOREAPP1_0;NETCORE</DefineConstants>
<DefineConstants>TRACE;RELEASE;NETSTANDARD</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETCORE
#if NETSTANDARD

using System;
using System.IO;
Expand Down
4 changes: 2 additions & 2 deletions src/Tests/FeatureToggle.NetCore/FeatureToggle.NetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;DEBUG;NETCOREAPP1_0;NETCORE</DefineConstants>
<DefineConstants>TRACE;DEBUG;NETSTANDARD</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE;RELEASE;NETCOREAPP1_0;NETCORE</DefineConstants>
<DefineConstants>TRACE;RELEASE;NETSTANDARD</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETFULL || NETCORE // no Moq support in UWP test projects
#if NETFULL || NETSTANDARD // no Moq support in UWP test projects

using System;
using FeatureToggle;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETFULL || NETCORE // no Moq support in UWP test projects
#if NETFULL || NETSTANDARD // no Moq support in UWP test projects

using System;
using FeatureToggle;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETFULL || NETCORE // no Moq support in UWP test projects
#if NETFULL || NETSTANDARD // no Moq support in UWP test projects

using System;
using FeatureToggle;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETFULL || NETCORE
#if NETFULL || NETSTANDARD

using System;
using FeatureToggle;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETFULL || NETCORE
#if NETFULL || NETSTANDARD

using System;
//using System.Configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETFULL || NETCORE
#if NETFULL || NETSTANDARD

using System;
using System.Linq;
Expand Down Expand Up @@ -28,7 +28,7 @@ public void InvalidDayInConfig()
var sut = new AppSettingsProvider();

var ex = Assert.Throws<ToggleConfigurationError>(() => sut.GetDaysOfWeek(new InvalidDayToggle()).ToList());
#if NETCORE
#if NETSTANDARD
Assert.Equal("The value 'Sun' in config key 'InvalidDayToggle' is not a valid day of the week. Days should be specified in long format. E.g. Friday and not Fri.", ex.Message);
#else
Assert.Equal("The value 'Sun' in config key 'FeatureToggle.InvalidDayToggle' is not a valid day of the week. Days should be specified in long format. E.g. Friday and not Fri.", ex.Message);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETFULL || NETCORE
#if NETFULL || NETSTANDARD


using System;
Expand Down Expand Up @@ -31,7 +31,7 @@ public void ErrorWhenEndDateFormatIsWrong()
() =>
new AppSettingsProvider().EvaluateTimePeriod(
new FormatInConfigIsWrong()));
#if NETCORE
#if NETSTANDARD
Assert.Equal(
"The value '02/01/2050 04:05:44' cannot be converted to a DateTime as defined in config key 'FormatInConfigIsWrong'. The expected format is: dd-MMM-yyyy HH:mm:ss",
ex.Message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using FeatureToggle.Internal;
using Xunit;

#if NETFULL || NETCORE
#if NETFULL || NETSTANDARD
using Moq;
#endif

Expand All @@ -15,14 +15,14 @@ public class SimpleFeatureToggleShould
public void HaveDefaultProvider()
{
var sut = new MySimpleFeatureToggle();
#if NETFULL || NETCORE
#if NETFULL || NETSTANDARD
Assert.Equal(typeof(AppSettingsProvider), sut.ToggleValueProvider.GetType());
#else
Assert.Equal(typeof(ApplicationResourcesSettingsProvider), sut.ToggleValueProvider.GetType());
#endif
}

#if NETFULL || NETCORE // can't Moq in UWP
#if NETFULL || NETSTANDARD // can't Moq in UWP
[Fact]
public void SetOptionalProviderOnCreation()
{
Expand Down