diff --git a/tests/Refractored.Xam.Settings.NUnitTest.Android/Assets/AboutAssets.txt b/tests/Plugin.Settings.NUnitTest.Android/Assets/AboutAssets.txt similarity index 100% rename from tests/Refractored.Xam.Settings.NUnitTest.Android/Assets/AboutAssets.txt rename to tests/Plugin.Settings.NUnitTest.Android/Assets/AboutAssets.txt diff --git a/tests/Refractored.Xam.Settings.NUnitTest.Android/MainActivity.cs b/tests/Plugin.Settings.NUnitTest.Android/MainActivity.cs similarity index 100% rename from tests/Refractored.Xam.Settings.NUnitTest.Android/MainActivity.cs rename to tests/Plugin.Settings.NUnitTest.Android/MainActivity.cs diff --git a/tests/Refractored.Xam.Settings.NUnitTest.Android/Refractored.Xam.Settings.NUnitTest.Android.csproj b/tests/Plugin.Settings.NUnitTest.Android/Plugin.Settings.NUnitTest.Android.csproj similarity index 88% rename from tests/Refractored.Xam.Settings.NUnitTest.Android/Refractored.Xam.Settings.NUnitTest.Android.csproj rename to tests/Plugin.Settings.NUnitTest.Android/Plugin.Settings.NUnitTest.Android.csproj index 3265cee..aacff48 100644 --- a/tests/Refractored.Xam.Settings.NUnitTest.Android/Refractored.Xam.Settings.NUnitTest.Android.csproj +++ b/tests/Plugin.Settings.NUnitTest.Android/Plugin.Settings.NUnitTest.Android.csproj @@ -61,9 +61,9 @@ - + @@ -79,17 +79,17 @@ - + {d12d6afa-0696-4177-9c85-ec576277ef8e} - Refractored.Xam.Settings.Abstractions + Plugin.Settings.Abstractions - + {91b25a78-62c8-41aa-8d22-da326a5ea64d} - Refractored.Xam.Settings.Android + Plugin.Settings.Android - + {2961bec8-6e97-4943-af17-491e25309619} - Refractored.Xam.Settings.Tests.Portable + Plugin.Settings.Tests.Portable diff --git a/tests/Refractored.Xam.Settings.NUnitTest.Android/Properties/AndroidManifest.xml b/tests/Plugin.Settings.NUnitTest.Android/Properties/AndroidManifest.xml similarity index 100% rename from tests/Refractored.Xam.Settings.NUnitTest.Android/Properties/AndroidManifest.xml rename to tests/Plugin.Settings.NUnitTest.Android/Properties/AndroidManifest.xml diff --git a/tests/Refractored.Xam.Settings.NUnitTest.Android/Properties/AssemblyInfo.cs b/tests/Plugin.Settings.NUnitTest.Android/Properties/AssemblyInfo.cs similarity index 100% rename from tests/Refractored.Xam.Settings.NUnitTest.Android/Properties/AssemblyInfo.cs rename to tests/Plugin.Settings.NUnitTest.Android/Properties/AssemblyInfo.cs diff --git a/tests/Refractored.Xam.Settings.NUnitTest.Android/Resources/AboutResources.txt b/tests/Plugin.Settings.NUnitTest.Android/Resources/AboutResources.txt similarity index 100% rename from tests/Refractored.Xam.Settings.NUnitTest.Android/Resources/AboutResources.txt rename to tests/Plugin.Settings.NUnitTest.Android/Resources/AboutResources.txt diff --git a/tests/Refractored.Xam.Settings.NUnitTest.Android/Resources/Resource.Designer.cs b/tests/Plugin.Settings.NUnitTest.Android/Resources/Resource.Designer.cs similarity index 100% rename from tests/Refractored.Xam.Settings.NUnitTest.Android/Resources/Resource.Designer.cs rename to tests/Plugin.Settings.NUnitTest.Android/Resources/Resource.Designer.cs diff --git a/tests/Refractored.Xam.Settings.NUnitTest.Android/Resources/drawable/Icon.png b/tests/Plugin.Settings.NUnitTest.Android/Resources/drawable/Icon.png similarity index 100% rename from tests/Refractored.Xam.Settings.NUnitTest.Android/Resources/drawable/Icon.png rename to tests/Plugin.Settings.NUnitTest.Android/Resources/drawable/Icon.png diff --git a/tests/Refractored.Xam.Settings.NUnitTest.Android/Resources/values/Strings.xml b/tests/Plugin.Settings.NUnitTest.Android/Resources/values/Strings.xml similarity index 100% rename from tests/Refractored.Xam.Settings.NUnitTest.Android/Resources/values/Strings.xml rename to tests/Plugin.Settings.NUnitTest.Android/Resources/values/Strings.xml diff --git a/tests/Refractored.Xam.Settings.NUnitTest.Android/TestSample.cs b/tests/Plugin.Settings.NUnitTest.Android/TestSample.cs similarity index 100% rename from tests/Refractored.Xam.Settings.NUnitTest.Android/TestSample.cs rename to tests/Plugin.Settings.NUnitTest.Android/TestSample.cs diff --git a/tests/Plugin.Settings.NUnitTest.Android/Tests.cs b/tests/Plugin.Settings.NUnitTest.Android/Tests.cs new file mode 100644 index 0000000..f7a6c41 --- /dev/null +++ b/tests/Plugin.Settings.NUnitTest.Android/Tests.cs @@ -0,0 +1,183 @@ +using System; +using NUnit.Framework; +using Plugin.Settings.Tests.Portable.Helpers; + + +namespace Plugin.Settings.NUnitTest +{ + [TestFixture] + public class TestsSample + { + + [SetUp] + public void Setup() { } + + + [TearDown] + public void Tear() { } + + [Test] + public void Int64() + { + Int64 test = 10; + + TestSettings.Int64Setting = test; + Assert.True(TestSettings.Int64Setting == test, "Int64 not saved"); + } + + [Test] + public void Clear() + { + Int64 test = 10; + + TestSettings.Int64Setting = test; + Assert.True(TestSettings.Int64Setting == test, "Int64 not saved"); + + TestSettings.AppSettings.Clear(); + + Assert.IsFalse(TestSettings.AppSettings.Contains("int64_setting"), "Setting was not removed"); + } + + [Test] + public void ContainsKey() + { + Int64 test = 10; + + Assert.IsFalse(TestSettings.AppSettings.Contains("int64_setting"), "Default value was not false"); + + TestSettings.Int64Setting = test; + + Assert.IsTrue(TestSettings.AppSettings.Contains("int64_setting"), "Default value was not false"); + + } + + + [Test] + public void Int32() + { + Int32 test = 10; + + TestSettings.Int32Setting = test; + Assert.True(TestSettings.Int32Setting == test, "Int32 not saved"); + } + + + [Test] + public void Int() + { + int test = 10; + + TestSettings.IntSetting = test; + Assert.True(TestSettings.IntSetting == test, "Int not saved"); + } + + [Test] + public void Bool() + { + var test = true; + + TestSettings.BoolSetting = test; + Assert.True(TestSettings.BoolSetting == test, "Bool not saved"); + } + + [Test] + public void Double() + { + double test = 10.001; + + TestSettings.DoubleSetting = test; + Assert.True(TestSettings.DoubleSetting == test, "Double not saved"); + } + + [Test] + public void Double_Zero() + { + double test = 0.0D; + + TestSettings.DoubleSetting = test; + Assert.True(TestSettings.DoubleSetting == test, "Double not saved"); + } + + [Test] + public void Double_Max() + { + double test = double.MaxValue; + + TestSettings.DoubleSetting = test; + Assert.True(TestSettings.DoubleSetting == test, "Double not saved"); + } + + [Test] + public void Double_Min() + { + double test = double.MinValue; + + TestSettings.DoubleSetting = test; + Assert.True(TestSettings.DoubleSetting == test, "Double not saved"); + } + + [Test] + public void Decimal() + { + decimal test = 0.099M; + + TestSettings.DecimalSetting = test; + Assert.True(TestSettings.DecimalSetting == test, "Decimal not saved"); + } + + [Test] + public void DateTime() + { + + DateTime test = new DateTime(1986, 6, 25, 4, 0, 0).ToUniversalTime(); + + TestSettings.DateTimeSetting = test; + Assert.True(TestSettings.DateTimeSetting.Value.Ticks == test.Ticks, "DateTime not saved"); + } + + [Test] + public void Guid() + { + Guid test = new Guid("EFFB4B96-92F3-4551-9732-36B11DC8B051"); + + TestSettings.GuidSetting = test; + Assert.True(TestSettings.GuidSetting.ToString() == test.ToString(), "Guid not saved"); + } + + + [Test] + public void AddRemove() + { + TestSettings.StringSetting = "Hello World"; + + TestSettings.DateTimeSetting = null; + + Assert.IsTrue(TestSettings.DateTimeSetting.HasValue, "Date wasn't set to null, it is: " + TestSettings.StringSetting); + + + + TestSettings.Remove("date_setting"); + + Assert.IsFalse(TestSettings.DateTimeSetting.HasValue, "String should be back to default of string.empty, it is: " + TestSettings.StringSetting); + } + + [Test] + public void Upgrade140To150TestAddAndUpdate() + { + //old value was stored as a long to test + TestSettings.AppSettings.AddOrUpdateValue("test1", (long)100); + //new value is stored as a string via decimal + TestSettings.AppSettings.AddOrUpdateValue("test1", (decimal)100.01M); + + Assert.IsTrue(TestSettings.AppSettings.GetValueOrDefault("test1", (decimal)100.02M) == (decimal)100.01M, "Decimal did not upgrade correctly"); + + + //old value was stored as a long to test + TestSettings.AppSettings.AddOrUpdateValue("test2", (long)100); + TestSettings.AppSettings.AddOrUpdateValue("test2", (double)100.01); + + Assert.IsTrue(TestSettings.AppSettings.GetValueOrDefault("test2", (double)100.02) == (double)100.01, "Double did not upgrade correctly"); + } + + } +} \ No newline at end of file diff --git a/tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/AppDelegate.cs b/tests/Plugin.Settings.NUnitTest.iOS/AppDelegate.cs similarity index 100% rename from tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/AppDelegate.cs rename to tests/Plugin.Settings.NUnitTest.iOS/AppDelegate.cs diff --git a/tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Info.plist b/tests/Plugin.Settings.NUnitTest.iOS/Info.plist similarity index 100% rename from tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Info.plist rename to tests/Plugin.Settings.NUnitTest.iOS/Info.plist diff --git a/tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Main.cs b/tests/Plugin.Settings.NUnitTest.iOS/Main.cs similarity index 100% rename from tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Main.cs rename to tests/Plugin.Settings.NUnitTest.iOS/Main.cs diff --git a/tests/Refractored.Xam.Settings.NUnitTest.iOS/Refractored.Xam.Settings.NUnitTest.iOS.csproj b/tests/Plugin.Settings.NUnitTest.iOS/Plugin.Settings.NUnitTest.iOS.csproj similarity index 68% rename from tests/Refractored.Xam.Settings.NUnitTest.iOS/Refractored.Xam.Settings.NUnitTest.iOS.csproj rename to tests/Plugin.Settings.NUnitTest.iOS/Plugin.Settings.NUnitTest.iOS.csproj index bc9d026..953a2b5 100644 --- a/tests/Refractored.Xam.Settings.NUnitTest.iOS/Refractored.Xam.Settings.NUnitTest.iOS.csproj +++ b/tests/Plugin.Settings.NUnitTest.iOS/Plugin.Settings.NUnitTest.iOS.csproj @@ -3,14 +3,12 @@ Debug iPhoneSimulator - 8.0.30703 - 2.0 {38DD1031-7DA2-4F7D-B6EF-060317B34950} - {6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} Exe - Refractored.Xam.Settings.NUnitTest.iOS + Refractored.Xam.Settings.NUnitTest.iOSUnified Resources - RefractoredXamSettingsNUnitTestiOS + RefractoredXamSettingsNUnitTestiOSUnified true @@ -21,8 +19,10 @@ prompt 4 false + i386, x86_64 None true + Entitlements.plist none @@ -30,8 +30,15 @@ bin\iPhoneSimulator\Release prompt 4 - false None + i386, x86_64 + false + + + iPhone Developer + + + true @@ -42,21 +49,9 @@ prompt 4 false - False + ARMv7, ARM64 iPhone Developer - 8.1 - SdkOnly - False - - False - True - Default, ARMv7 - False - False - False - False - False - + true none @@ -64,6 +59,8 @@ bin\iPhone\Release prompt 4 + Entitlements.plist + ARMv7, ARM64 false iPhone Developer @@ -74,8 +71,11 @@ prompt 4 False - iPhone Distribution + ARMv7, ARM64 + Entitlements.plist True + Automatic:AdHoc + iPhone Distribution none @@ -84,11 +84,14 @@ prompt 4 False + ARMv7, ARM64 + Entitlements.plist + Automatic:AppStore iPhone Distribution - - TestSample.cs + + Tests.cs @@ -107,21 +110,23 @@ - + - + {d12d6afa-0696-4177-9c85-ec576277ef8e} - Refractored.Xam.Settings.Abstractions + Plugin.Settings.Abstractions - - {c598e2c2-e094-42b7-a8d7-be83e1c72c86} - Refractored.Xam.Settings.iOS + + {fcf19725-8c2f-44c5-aa52-513ee32469e2} + Plugin.Settings.iOSUnified + false + false - + {2961bec8-6e97-4943-af17-491e25309619} - Refractored.Xam.Settings.Tests.Portable + Plugin.Settings.Tests.Portable - + \ No newline at end of file diff --git a/tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Properties/AssemblyInfo.cs b/tests/Plugin.Settings.NUnitTest.iOS/Properties/AssemblyInfo.cs similarity index 100% rename from tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Properties/AssemblyInfo.cs rename to tests/Plugin.Settings.NUnitTest.iOS/Properties/AssemblyInfo.cs diff --git a/tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Refractored.Xam.Settings.NUnitTest.iOSUnified.csproj b/tests/Plugin.Settings.NUnitTest.iOS/Refractored.Xam.Settings.NUnitTest.iOSUnified.csproj similarity index 88% rename from tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Refractored.Xam.Settings.NUnitTest.iOSUnified.csproj rename to tests/Plugin.Settings.NUnitTest.iOS/Refractored.Xam.Settings.NUnitTest.iOSUnified.csproj index dc92915..67f47a8 100644 --- a/tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Refractored.Xam.Settings.NUnitTest.iOSUnified.csproj +++ b/tests/Plugin.Settings.NUnitTest.iOS/Refractored.Xam.Settings.NUnitTest.iOSUnified.csproj @@ -3,7 +3,7 @@ Debug iPhoneSimulator - {0C283E74-8FEF-4441-A9B4-708DC70C3E35} + {38DD1031-7DA2-4F7D-B6EF-060317B34950} {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} Exe Refractored.Xam.Settings.NUnitTest.iOSUnified @@ -91,9 +91,6 @@ iPhone Distribution - - TestSample.cs - @@ -114,18 +111,14 @@ - + {d12d6afa-0696-4177-9c85-ec576277ef8e} Refractored.Xam.Settings.Abstractions - + {fcf19725-8c2f-44c5-aa52-513ee32469e2} Refractored.Xam.Settings.iOSUnified - - {2961bec8-6e97-4943-af17-491e25309619} - Refractored.Xam.Settings.Tests.Portable - \ No newline at end of file diff --git a/tests/Refractored.Xam.Settings.NUnitTest.iOS/Resources/Default-568h@2x.png b/tests/Plugin.Settings.NUnitTest.iOS/Resources/Default-568h@2x.png similarity index 100% rename from tests/Refractored.Xam.Settings.NUnitTest.iOS/Resources/Default-568h@2x.png rename to tests/Plugin.Settings.NUnitTest.iOS/Resources/Default-568h@2x.png diff --git a/tests/Refractored.Xam.Settings.NUnitTest.iOS/Resources/Default.png b/tests/Plugin.Settings.NUnitTest.iOS/Resources/Default.png similarity index 100% rename from tests/Refractored.Xam.Settings.NUnitTest.iOS/Resources/Default.png rename to tests/Plugin.Settings.NUnitTest.iOS/Resources/Default.png diff --git a/tests/Refractored.Xam.Settings.NUnitTest.iOS/Resources/Default@2x.png b/tests/Plugin.Settings.NUnitTest.iOS/Resources/Default@2x.png similarity index 100% rename from tests/Refractored.Xam.Settings.NUnitTest.iOS/Resources/Default@2x.png rename to tests/Plugin.Settings.NUnitTest.iOS/Resources/Default@2x.png diff --git a/tests/Plugin.Settings.Tests.Portable/Helpers/TestSettings.cs b/tests/Plugin.Settings.Tests.Portable/Helpers/TestSettings.cs new file mode 100644 index 0000000..bdf7e1a --- /dev/null +++ b/tests/Plugin.Settings.Tests.Portable/Helpers/TestSettings.cs @@ -0,0 +1,164 @@ +// Helpers/Settings.cs +using Plugin.Settings.Abstractions; +using System; + +namespace Plugin.Settings.Tests.Portable.Helpers +{ + /// + /// This is the Settings static class that can be used in your Core solution or in any + /// of your client applications. All settings are laid out the same exact way with getters + /// and setters. + /// + public static class TestSettings + { + public static ISettings AppSettings + { + get + { + return CrossSettings.Current; + } + } + + #region Setting Constants + + public const string SettingsKey = "settings_key"; + private static readonly string SettingsDefault = string.Empty; + + #endregion + + public static Guid GuidSetting + { + get + { + return AppSettings.GetValueOrDefault("guid_setting", Guid.Empty); + } + set + { + //if value has changed then save it! + AppSettings.AddOrUpdateValue("guid_setting", value); + } + } + + public static decimal DecimalSetting + { + get + { + return AppSettings.GetValueOrDefault("decimal_setting", (decimal)0); + } + set + { + //if value has changed then save it! + AppSettings.AddOrUpdateValue("decimal_setting", value); + } + } + + public static int IntSetting + { + get + { + return AppSettings.GetValueOrDefault("int_setting", (int)0); + } + set + { + //if value has changed then save it! + AppSettings.AddOrUpdateValue("int_setting", value); + } + } + + public static float FloatSetting + { + get + { + return AppSettings.GetValueOrDefault("float_setting", (float)0); + } + set + { + //if value has changed then save it! + AppSettings.AddOrUpdateValue("float_setting", value); + } + } + + public static Int64 Int64Setting + { + get + { + return AppSettings.GetValueOrDefault("int64_setting", (Int64)0); + } + set + { + //if value has changed then save it! + AppSettings.AddOrUpdateValue("int64_setting", value); + } + } + + public static Int32 Int32Setting + { + get + { + return AppSettings.GetValueOrDefault("int32_setting", (Int32)0); + } + set + { + //if value has changed then save it! + AppSettings.AddOrUpdateValue("int32_setting", value); + } + } + + public static DateTime? DateTimeSetting + { + get + { + return AppSettings.GetValueOrDefault("date_setting"); + } + set + { + //if value has changed then save it! + AppSettings.AddOrUpdateValue("date_setting", value); + } + } + + public static double DoubleSetting + { + get + { + return AppSettings.GetValueOrDefault("double_setting", (double)0); + } + set + { + //if value has changed then save it! + AppSettings.AddOrUpdateValue("double_setting", value); + } + } + + public static bool BoolSetting + { + get + { + return AppSettings.GetValueOrDefault("bool_setting", false); + } + set + { + AppSettings.AddOrUpdateValue("bool_setting", value); + } + } + + public static string StringSetting + { + get + { + return AppSettings.GetValueOrDefault(SettingsKey, SettingsDefault); + } + set + { + //if value has changed then save it! + AppSettings.AddOrUpdateValue(SettingsKey, value); + } + } + + public static void Remove(string key) + { + AppSettings.Remove(key); + } + + } +} \ No newline at end of file diff --git a/tests/Refractored.Xam.Settings.Tests.Portable/Refractored.Xam.Settings.Tests.Portable.csproj b/tests/Plugin.Settings.Tests.Portable/Plugin.Settings.Tests.Portable.csproj similarity index 89% rename from tests/Refractored.Xam.Settings.Tests.Portable/Refractored.Xam.Settings.Tests.Portable.csproj rename to tests/Plugin.Settings.Tests.Portable/Plugin.Settings.Tests.Portable.csproj index d1846d0..6b4801f 100644 --- a/tests/Refractored.Xam.Settings.Tests.Portable/Refractored.Xam.Settings.Tests.Portable.csproj +++ b/tests/Plugin.Settings.Tests.Portable/Plugin.Settings.Tests.Portable.csproj @@ -37,13 +37,13 @@ - + {d12d6afa-0696-4177-9c85-ec576277ef8e} - Refractored.Xam.Settings.Abstractions + Plugin.Settings.Abstractions - + {747706f4-ecbf-4d50-8d72-b0ddcc18395c} - Refractored.Xam.Settings + Plugin.Settings diff --git a/tests/Refractored.Xam.Settings.Tests.Portable/Properties/AssemblyInfo.cs b/tests/Plugin.Settings.Tests.Portable/Properties/AssemblyInfo.cs similarity index 100% rename from tests/Refractored.Xam.Settings.Tests.Portable/Properties/AssemblyInfo.cs rename to tests/Plugin.Settings.Tests.Portable/Properties/AssemblyInfo.cs diff --git a/tests/Plugin.Settings.Tests/Plugin.Settings.Tests.projitems b/tests/Plugin.Settings.Tests/Plugin.Settings.Tests.projitems new file mode 100644 index 0000000..eb9b1d7 --- /dev/null +++ b/tests/Plugin.Settings.Tests/Plugin.Settings.Tests.projitems @@ -0,0 +1,14 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + bf22d037-a5fc-4f7e-81fb-9bd8a3b04c7c + + + Plugin.Settings.Tests + + + + + \ No newline at end of file diff --git a/tests/Plugin.Settings.Tests/Plugin.Settings.Tests.shproj b/tests/Plugin.Settings.Tests/Plugin.Settings.Tests.shproj new file mode 100644 index 0000000..db74b07 --- /dev/null +++ b/tests/Plugin.Settings.Tests/Plugin.Settings.Tests.shproj @@ -0,0 +1,13 @@ + + + + bf22d037-a5fc-4f7e-81fb-9bd8a3b04c7c + 14.0 + + + + + + + + diff --git a/tests/Plugin.Settings.Tests/Tests.cs b/tests/Plugin.Settings.Tests/Tests.cs new file mode 100644 index 0000000..63b49be --- /dev/null +++ b/tests/Plugin.Settings.Tests/Tests.cs @@ -0,0 +1,158 @@ +using System; +using NUnit.Framework; +using Plugin.Settings.Tests.Portable.Helpers; + + +namespace Plugin.Settings.NUnitTest +{ + [TestFixture] + public class TestsSample + { + + [SetUp] + public void Setup() { } + + + [TearDown] + public void Tear() { } + + [Test] + public void Int64() + { + Int64 test = 10; + + TestSettings.Int64Setting = test; + Assert.True(TestSettings.Int64Setting == test, "Int64 not saved"); + } + + + [Test] + public void Int32() + { + Int32 test = 10; + + TestSettings.Int32Setting = test; + Assert.True(TestSettings.Int32Setting == test, "Int32 not saved"); + } + + + [Test] + public void Int() + { + int test = 10; + + TestSettings.IntSetting = test; + Assert.True(TestSettings.IntSetting == test, "Int not saved"); + } + + [Test] + public void Bool() + { + var test = true; + + TestSettings.BoolSetting = test; + Assert.True(TestSettings.BoolSetting == test, "Bool not saved"); + } + + [Test] + public void Double() + { + double test = 10.001; + + TestSettings.DoubleSetting = test; + Assert.True(TestSettings.DoubleSetting == test, "Double not saved"); + } + + [Test] + public void Decimal() + { + decimal test = 0.099M; + + TestSettings.DecimalSetting = test; + Assert.True(TestSettings.DecimalSetting == test, "Decimal not saved"); + } + + [Test] + public void DateTime() + { + + DateTime test = new DateTime(1986, 6, 25, 4, 0, 0); + + TestSettings.DateTimeSetting = test; + Assert.True(TestSettings.DateTimeSetting.Value.Ticks == test.Ticks, "DateTime not saved"); + } + + [Test] + public void Guid() + { + Guid test = new Guid("EFFB4B96-92F3-4551-9732-36B11DC8B051"); + + TestSettings.GuidSetting = test; + Assert.True(TestSettings.GuidSetting.ToString() == test.ToString(), "Guid not saved"); + } + + + [Test] + public void AddRemove() + { + TestSettings.StringSetting = "Hello World"; + + TestSettings.DateTimeSetting = null; + + Assert.IsTrue(TestSettings.DateTimeSetting.HasValue, "Date wasn't set to null, it is: " + TestSettings.StringSetting); + + + + TestSettings.Remove("date_setting"); + + Assert.IsFalse(TestSettings.DateTimeSetting.HasValue, "String should be back to default of string.empty, it is: " + TestSettings.StringSetting); + } + + [Test] + public void Upgrade140To150Test() + { + //old value was stored as a long to test + TestSettings.AppSettings.AddOrUpdateValue("test1", (long)100); + + Assert.IsTrue(TestSettings.AppSettings.GetValueOrDefault("test1", (decimal)101.01M) == (decimal)100M, "Decimal did not upgrade correctly"); + Assert.IsTrue(TestSettings.AppSettings.GetValueOrDefault("test1", (decimal)101.01M) == (decimal)100M, "Decimal did not upgrade correctly"); + + + //new value is stored as a string via decimal + TestSettings.AppSettings.AddOrUpdateValue("test1", (decimal)100.01M); + + Assert.IsTrue(TestSettings.AppSettings.GetValueOrDefault("test1", (decimal)100.02M) == (decimal)100.01M, "Decimal did not upgrade correctly"); + + + //old value was stored as a long to test + TestSettings.AppSettings.AddOrUpdateValue("test2", (long)100); + + Assert.IsTrue(TestSettings.AppSettings.GetValueOrDefault("test2", (double)101) == (double)100, "Double did not upgrade correctly"); + Assert.IsTrue(TestSettings.AppSettings.GetValueOrDefault("test2", (double)101) == (double)100, "Double did not upgrade correctly"); + + //new value is stored as a string via decimal + TestSettings.AppSettings.AddOrUpdateValue("test2", (double)100.01); + + Assert.IsTrue(TestSettings.AppSettings.GetValueOrDefault("test2", (double)100.02) == (double)100.01, "Double did not upgrade correctly"); + } + + [Test] + public void Upgrade140To150TestAddAndUpdate() + { + //old value was stored as a long to test + TestSettings.AppSettings.AddOrUpdateValue("test1", (long)100); + //new value is stored as a string via decimal + TestSettings.AppSettings.AddOrUpdateValue("test1", (decimal)100.01M); + + Assert.IsTrue(TestSettings.AppSettings.GetValueOrDefault("test1", (decimal)100.02M) == (decimal)100.01M, "Decimal did not upgrade correctly"); + + + //old value was stored as a long to test + TestSettings.AppSettings.AddOrUpdateValue("test2", (long)100); + TestSettings.AppSettings.AddOrUpdateValue("test2", (double)100.01); + + Assert.IsTrue(TestSettings.AppSettings.GetValueOrDefault("test2", (double)100.02) == (double)100.01, "Double did not upgrade correctly"); + } + + } +} \ No newline at end of file diff --git a/tests/Refractored.Xam.Settings.NUnitTest.iOS/AppDelegate.cs b/tests/Refractored.Xam.Settings.NUnitTest.iOS/AppDelegate.cs deleted file mode 100644 index c6fc6da..0000000 --- a/tests/Refractored.Xam.Settings.NUnitTest.iOS/AppDelegate.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -using MonoTouch.Foundation; -using MonoTouch.UIKit; -using MonoTouch.NUnit.UI; - -namespace Plugin.Settings.NUnitTest.iOS -{ - // The UIApplicationDelegate for the application. This class is responsible for launching the - // User Interface of the application, as well as listening (and optionally responding) to - // application events from iOS. - [Register("AppDelegate")] - public partial class AppDelegate : UIApplicationDelegate - { - // class-level declarations - UIWindow window; - TouchRunner runner; - - // - // This method is invoked when the application has loaded and is ready to run. In this - // method you should instantiate the window, load the UI into it and then make the window - // visible. - // - // You have 17 seconds to return from this method, or iOS will terminate your application. - // - public override bool FinishedLaunching(UIApplication app, NSDictionary options) - { - // create a new window instance based on the screen size - window = new UIWindow(UIScreen.MainScreen.Bounds); - runner = new TouchRunner(window); - - // register every tests included in the main application/assembly - runner.Add(System.Reflection.Assembly.GetExecutingAssembly()); - - window.RootViewController = new UINavigationController(runner.GetViewController()); - - // make the window visible - window.MakeKeyAndVisible(); - - return true; - } - } -} \ No newline at end of file diff --git a/tests/Refractored.Xam.Settings.NUnitTest.iOS/Info.plist b/tests/Refractored.Xam.Settings.NUnitTest.iOS/Info.plist deleted file mode 100644 index a511415..0000000 --- a/tests/Refractored.Xam.Settings.NUnitTest.iOS/Info.plist +++ /dev/null @@ -1,34 +0,0 @@ - - - - - CFBundleDisplayName - Plugin.Settings.NUnitTest.iOS - CFBundleIdentifier - com.your-company.Plugin.Settings.NUnitTest.iOS - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1.0 - UIDeviceFamily - - 1 - 2 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - MinimumOSVersion - 7.0 - - \ No newline at end of file diff --git a/tests/Refractored.Xam.Settings.NUnitTest.iOS/Main.cs b/tests/Refractored.Xam.Settings.NUnitTest.iOS/Main.cs deleted file mode 100644 index f024f4a..0000000 --- a/tests/Refractored.Xam.Settings.NUnitTest.iOS/Main.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -using MonoTouch.Foundation; -using MonoTouch.UIKit; - -namespace Plugin.Settings.NUnitTest.iOS -{ - public class Application - { - // This is the main entry point of the application. - static void Main(string[] args) - { - // if you want to use a different Application Delegate class from "AppDelegate" - // you can specify it here. - UIApplication.Main(args, null, "AppDelegate"); - } - } -} \ No newline at end of file diff --git a/tests/Refractored.Xam.Settings.NUnitTest.iOS/Properties/AssemblyInfo.cs b/tests/Refractored.Xam.Settings.NUnitTest.iOS/Properties/AssemblyInfo.cs deleted file mode 100644 index 34f3f35..0000000 --- a/tests/Refractored.Xam.Settings.NUnitTest.iOS/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Plugin.Settings.NUnitTest.iOS")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Plugin.Settings.NUnitTest.iOS")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("8c095fff-5a28-469d-9bd3-cb9ac57ca105")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Resources/Default-568h@2x.png b/tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Resources/Default-568h@2x.png deleted file mode 100644 index b3f6678..0000000 Binary files a/tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Resources/Default-568h@2x.png and /dev/null differ diff --git a/tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Resources/Default.png b/tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Resources/Default.png deleted file mode 100644 index 7ad63b0..0000000 Binary files a/tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Resources/Default.png and /dev/null differ diff --git a/tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Resources/Default@2x.png b/tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Resources/Default@2x.png deleted file mode 100644 index 8d59426..0000000 Binary files a/tests/Refractored.Xam.Settings.NUnitTest.iOSUnified/Resources/Default@2x.png and /dev/null differ diff --git a/tests/Refractored.Xam.Settings.Tests.Android/Activity1.cs b/tests/Refractored.Xam.Settings.Tests.Android/Activity1.cs deleted file mode 100644 index 509b0d3..0000000 --- a/tests/Refractored.Xam.Settings.Tests.Android/Activity1.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; - -using Android.App; -using Android.Content; -using Android.Runtime; -using Android.Views; -using Android.Widget; -using Android.OS; -using Refractored.Xam.Settings.Tests.Android; - -namespace Plugin.Settings.Tests.Android -{ - [Activity(Label = "Plugin.Settings.Tests.Android", MainLauncher = true, Icon = "@drawable/icon")] - public class Activity1 : Activity - { - int count = 1; - - protected override void OnCreate(Bundle bundle) - { - base.OnCreate(bundle); - - // Set our view from the "main" layout resource - SetContentView(Resource.Layout.Main); - - // Get our button from the layout resource, - // and attach an event to it - Button button = FindViewById