From 07a92d0da592ad23fe98a4b60d3f9e963acc7e0c Mon Sep 17 00:00:00 2001 From: Johan de Koning Date: Tue, 14 Apr 2020 20:34:25 +0200 Subject: [PATCH] Convert .net core to .net standard --- src/FeatureToggle.Shared/Internal/AppSettingsProvider.cs | 8 ++++---- src/FeatureToggle/FeatureToggle.csproj | 9 +++++---- .../FeatureToggle.NetCore.Tests.csproj | 4 ++-- .../FeatureToggle.NetCore.Tests/SolutionPathUtility.cs | 2 +- .../FeatureToggle.NetCore/FeatureToggle.NetCore.csproj | 4 ++-- .../EnabledBetweenDatesFeatureToggleShould.cs | 2 +- .../EnabledOnDaysOfWeekFeatureToggleShould.cs | 2 +- .../EnabledOnOrAfterDateFeatureToggleShould.cs | 2 +- .../Integration/AppSettingsProviderBooleanShould.cs | 2 +- .../Integration/AppSettingsProviderDateTimeShould.cs | 2 +- .../AppSettingsProviderForDaysOfWeekShould.cs | 4 ++-- .../Integration/AppSettingsProviderTimePeriodShould.cs | 4 ++-- .../SimpleFeatureToggleShould.cs | 6 +++--- 13 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/FeatureToggle.Shared/Internal/AppSettingsProvider.cs b/src/FeatureToggle.Shared/Internal/AppSettingsProvider.cs index c703703..a824ee9 100644 --- a/src/FeatureToggle.Shared/Internal/AppSettingsProvider.cs +++ b/src/FeatureToggle.Shared/Internal/AppSettingsProvider.cs @@ -1,4 +1,4 @@ -#if NETFULL || NETCORE +#if NETFULL || NETSTANDARD using System; using System.Collections.Generic; @@ -12,7 +12,7 @@ using System.Web.Script.Serialization; #endif -#if NETCORE +#if NETSTANDARD using Microsoft.Extensions.Configuration; using System.IO; #endif @@ -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; @@ -235,7 +235,7 @@ private string GetConfigValue(string key) } -#if NETCORE +#if NETSTANDARD private static string AppDirectory => AppContext.BaseDirectory; #endif diff --git a/src/FeatureToggle/FeatureToggle.csproj b/src/FeatureToggle/FeatureToggle.csproj index 09226b8..29ad261 100644 --- a/src/FeatureToggle/FeatureToggle.csproj +++ b/src/FeatureToggle/FeatureToggle.csproj @@ -2,7 +2,7 @@ en-US - net461;uap10.0;netcoreapp1.0; + net461;uap10.0;netstandard1.4; False True 4.0.2 @@ -18,13 +18,14 @@ For release notes and history see https://github.com/jason-roberts/FeatureToggle/blob/master/Release-Notes.md - - NETCORE;NETCOREAPP1_0 + + NETSTANDARD - + + diff --git a/src/Tests/FeatureToggle.NetCore.Tests/FeatureToggle.NetCore.Tests.csproj b/src/Tests/FeatureToggle.NetCore.Tests/FeatureToggle.NetCore.Tests.csproj index 7d8920b..3fc5c7c 100644 --- a/src/Tests/FeatureToggle.NetCore.Tests/FeatureToggle.NetCore.Tests.csproj +++ b/src/Tests/FeatureToggle.NetCore.Tests/FeatureToggle.NetCore.Tests.csproj @@ -6,11 +6,11 @@ - TRACE;DEBUG;NETCOREAPP1_0;NETCORE + TRACE;DEBUG;NETSTANDARD - TRACE;RELEASE;NETCOREAPP1_0;NETCORE + TRACE;RELEASE;NETSTANDARD diff --git a/src/Tests/FeatureToggle.NetCore.Tests/SolutionPathUtility.cs b/src/Tests/FeatureToggle.NetCore.Tests/SolutionPathUtility.cs index 7229b8a..de8c15b 100644 --- a/src/Tests/FeatureToggle.NetCore.Tests/SolutionPathUtility.cs +++ b/src/Tests/FeatureToggle.NetCore.Tests/SolutionPathUtility.cs @@ -1,4 +1,4 @@ -#if NETCORE +#if NETSTANDARD using System; using System.IO; diff --git a/src/Tests/FeatureToggle.NetCore/FeatureToggle.NetCore.csproj b/src/Tests/FeatureToggle.NetCore/FeatureToggle.NetCore.csproj index 9bb236b..7d9b206 100644 --- a/src/Tests/FeatureToggle.NetCore/FeatureToggle.NetCore.csproj +++ b/src/Tests/FeatureToggle.NetCore/FeatureToggle.NetCore.csproj @@ -5,11 +5,11 @@ - TRACE;DEBUG;NETCOREAPP1_0;NETCORE + TRACE;DEBUG;NETSTANDARD - TRACE;RELEASE;NETCOREAPP1_0;NETCORE + TRACE;RELEASE;NETSTANDARD diff --git a/src/Tests/FeatureToggle.Shared.Tests/EnabledBetweenDatesFeatureToggleShould.cs b/src/Tests/FeatureToggle.Shared.Tests/EnabledBetweenDatesFeatureToggleShould.cs index 16a023c..d394013 100644 --- a/src/Tests/FeatureToggle.Shared.Tests/EnabledBetweenDatesFeatureToggleShould.cs +++ b/src/Tests/FeatureToggle.Shared.Tests/EnabledBetweenDatesFeatureToggleShould.cs @@ -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; diff --git a/src/Tests/FeatureToggle.Shared.Tests/EnabledOnDaysOfWeekFeatureToggleShould.cs b/src/Tests/FeatureToggle.Shared.Tests/EnabledOnDaysOfWeekFeatureToggleShould.cs index 1d3d687..916f091 100644 --- a/src/Tests/FeatureToggle.Shared.Tests/EnabledOnDaysOfWeekFeatureToggleShould.cs +++ b/src/Tests/FeatureToggle.Shared.Tests/EnabledOnDaysOfWeekFeatureToggleShould.cs @@ -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; diff --git a/src/Tests/FeatureToggle.Shared.Tests/EnabledOnOrAfterDateFeatureToggleShould.cs b/src/Tests/FeatureToggle.Shared.Tests/EnabledOnOrAfterDateFeatureToggleShould.cs index 5de7c28..95263e8 100644 --- a/src/Tests/FeatureToggle.Shared.Tests/EnabledOnOrAfterDateFeatureToggleShould.cs +++ b/src/Tests/FeatureToggle.Shared.Tests/EnabledOnOrAfterDateFeatureToggleShould.cs @@ -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; diff --git a/src/Tests/FeatureToggle.Shared.Tests/Integration/AppSettingsProviderBooleanShould.cs b/src/Tests/FeatureToggle.Shared.Tests/Integration/AppSettingsProviderBooleanShould.cs index f8944c1..748f3d0 100644 --- a/src/Tests/FeatureToggle.Shared.Tests/Integration/AppSettingsProviderBooleanShould.cs +++ b/src/Tests/FeatureToggle.Shared.Tests/Integration/AppSettingsProviderBooleanShould.cs @@ -1,4 +1,4 @@ -#if NETFULL || NETCORE +#if NETFULL || NETSTANDARD using System; using FeatureToggle; diff --git a/src/Tests/FeatureToggle.Shared.Tests/Integration/AppSettingsProviderDateTimeShould.cs b/src/Tests/FeatureToggle.Shared.Tests/Integration/AppSettingsProviderDateTimeShould.cs index 12577a0..3736496 100644 --- a/src/Tests/FeatureToggle.Shared.Tests/Integration/AppSettingsProviderDateTimeShould.cs +++ b/src/Tests/FeatureToggle.Shared.Tests/Integration/AppSettingsProviderDateTimeShould.cs @@ -1,4 +1,4 @@ -#if NETFULL || NETCORE +#if NETFULL || NETSTANDARD using System; //using System.Configuration; diff --git a/src/Tests/FeatureToggle.Shared.Tests/Integration/AppSettingsProviderForDaysOfWeekShould.cs b/src/Tests/FeatureToggle.Shared.Tests/Integration/AppSettingsProviderForDaysOfWeekShould.cs index b4cbbb9..6adf34b 100644 --- a/src/Tests/FeatureToggle.Shared.Tests/Integration/AppSettingsProviderForDaysOfWeekShould.cs +++ b/src/Tests/FeatureToggle.Shared.Tests/Integration/AppSettingsProviderForDaysOfWeekShould.cs @@ -1,4 +1,4 @@ -#if NETFULL || NETCORE +#if NETFULL || NETSTANDARD using System; using System.Linq; @@ -28,7 +28,7 @@ public void InvalidDayInConfig() var sut = new AppSettingsProvider(); var ex = Assert.Throws(() => 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); diff --git a/src/Tests/FeatureToggle.Shared.Tests/Integration/AppSettingsProviderTimePeriodShould.cs b/src/Tests/FeatureToggle.Shared.Tests/Integration/AppSettingsProviderTimePeriodShould.cs index 7984785..af6a1e7 100644 --- a/src/Tests/FeatureToggle.Shared.Tests/Integration/AppSettingsProviderTimePeriodShould.cs +++ b/src/Tests/FeatureToggle.Shared.Tests/Integration/AppSettingsProviderTimePeriodShould.cs @@ -1,4 +1,4 @@ -#if NETFULL || NETCORE +#if NETFULL || NETSTANDARD using System; @@ -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); diff --git a/src/Tests/FeatureToggle.Shared.Tests/SimpleFeatureToggleShould.cs b/src/Tests/FeatureToggle.Shared.Tests/SimpleFeatureToggleShould.cs index 1be9fe8..4211b73 100644 --- a/src/Tests/FeatureToggle.Shared.Tests/SimpleFeatureToggleShould.cs +++ b/src/Tests/FeatureToggle.Shared.Tests/SimpleFeatureToggleShould.cs @@ -3,7 +3,7 @@ using FeatureToggle.Internal; using Xunit; -#if NETFULL || NETCORE +#if NETFULL || NETSTANDARD using Moq; #endif @@ -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() {