Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Update Test Projects for iOS and Android
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmontemagno committed Jul 7, 2016
1 parent 96bcdb5 commit e63c608
Show file tree
Hide file tree
Showing 45 changed files with 757 additions and 965 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
<Compile Include="TestSample.cs" />
<Compile Include="Resources\Resource.Designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Tests.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
Expand All @@ -79,17 +79,17 @@
<Content Include="Properties\AndroidManifest.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Refractored.Xam.Settings.Abstractions\Refractored.Xam.Settings.Abstractions.csproj">
<ProjectReference Include="..\..\src\Plugin.Settings.Abstractions\Plugin.Settings.Abstractions.csproj">
<Project>{d12d6afa-0696-4177-9c85-ec576277ef8e}</Project>
<Name>Refractored.Xam.Settings.Abstractions</Name>
<Name>Plugin.Settings.Abstractions</Name>
</ProjectReference>
<ProjectReference Include="..\Refractored.Xam.Settings.Android\Refractored.Xam.Settings.Android.csproj">
<ProjectReference Include="..\..\src\Plugin.Settings.Android\Plugin.Settings.Android.csproj">
<Project>{91b25a78-62c8-41aa-8d22-da326a5ea64d}</Project>
<Name>Refractored.Xam.Settings.Android</Name>
<Name>Plugin.Settings.Android</Name>
</ProjectReference>
<ProjectReference Include="..\Refractored.Xam.Settings.Tests.Portable\Refractored.Xam.Settings.Tests.Portable.csproj">
<ProjectReference Include="..\Plugin.Settings.Tests.Portable\Plugin.Settings.Tests.Portable.csproj">
<Project>{2961bec8-6e97-4943-af17-491e25309619}</Project>
<Name>Refractored.Xam.Settings.Tests.Portable</Name>
<Name>Plugin.Settings.Tests.Portable</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
Expand Down
183 changes: 183 additions & 0 deletions tests/Plugin.Settings.NUnitTest.Android/Tests.cs
Original file line number Diff line number Diff line change
@@ -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<decimal>("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<double>("test2", (double)100.02) == (double)100.01, "Double did not upgrade correctly");
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{38DD1031-7DA2-4F7D-B6EF-060317B34950}</ProjectGuid>
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>Refractored.Xam.Settings.NUnitTest.iOS</RootNamespace>
<RootNamespace>Refractored.Xam.Settings.NUnitTest.iOSUnified</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>RefractoredXamSettingsNUnitTestiOS</AssemblyName>
<AssemblyName>RefractoredXamSettingsNUnitTestiOSUnified</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -21,17 +19,26 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchArch>i386, x86_64</MtouchArch>
<MtouchLink>None</MtouchLink>
<MtouchDebug>true</MtouchDebug>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchLink>None</MtouchLink>
<MtouchArch>i386, x86_64</MtouchArch>
<ConsolePause>false</ConsolePause>
<CodesignEntitlements>
</CodesignEntitlements>
<CodesignKey>iPhone Developer</CodesignKey>
<CodesignProvision />
<CodesignResourceRules />
<CodesignExtraArgs />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -42,28 +49,18 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchDebug>False</MtouchDebug>
<MtouchArch>ARMv7, ARM64</MtouchArch>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchSdkVersion>8.1</MtouchSdkVersion>
<MtouchLink>SdkOnly</MtouchLink>
<MtouchProfiling>False</MtouchProfiling>
<MtouchExtraArgs />
<MtouchFastDev>False</MtouchFastDev>
<MtouchEnableGenericValueTypeSharing>True</MtouchEnableGenericValueTypeSharing>
<MtouchArch>Default, ARMv7</MtouchArch>
<MtouchUseLlvm>False</MtouchUseLlvm>
<MtouchUseThumb>False</MtouchUseThumb>
<MtouchUseSGen>False</MtouchUseSGen>
<MtouchUseRefCounting>False</MtouchUseRefCounting>
<MtouchOptimizePNGs>False</MtouchOptimizePNGs>
<MtouchI18n />
<MtouchDebug>true</MtouchDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchArch>ARMv7, ARM64</MtouchArch>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
Expand All @@ -74,8 +71,11 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<CodesignKey>iPhone Distribution</CodesignKey>
<MtouchArch>ARMv7, ARM64</MtouchArch>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<BuildIpa>True</BuildIpa>
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
<CodesignKey>iPhone Distribution</CodesignKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
<DebugType>none</DebugType>
Expand All @@ -84,11 +84,14 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<MtouchArch>ARMv7, ARM64</MtouchArch>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<CodesignProvision>Automatic:AppStore</CodesignProvision>
<CodesignKey>iPhone Distribution</CodesignKey>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Refractored.Xam.Settings.NUnitTest.Android\TestSample.cs">
<Link>TestSample.cs</Link>
<Compile Include="..\Plugin.Settings.NUnitTest.Android\Tests.cs">
<Link>Tests.cs</Link>
</Compile>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
Expand All @@ -107,21 +110,23 @@
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="monotouch" />
<Reference Include="Xamarin.iOS" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Refractored.Xam.Settings.Abstractions\Refractored.Xam.Settings.Abstractions.csproj">
<ProjectReference Include="..\..\src\Plugin.Settings.Abstractions\Plugin.Settings.Abstractions.csproj">
<Project>{d12d6afa-0696-4177-9c85-ec576277ef8e}</Project>
<Name>Refractored.Xam.Settings.Abstractions</Name>
<Name>Plugin.Settings.Abstractions</Name>
</ProjectReference>
<ProjectReference Include="..\Refractored.Xam.Settings.iOS\Refractored.Xam.Settings.iOS.csproj">
<Project>{c598e2c2-e094-42b7-a8d7-be83e1c72c86}</Project>
<Name>Refractored.Xam.Settings.iOS</Name>
<ProjectReference Include="..\..\src\Plugin.Settings.iOSUnified\Plugin.Settings.iOSUnified.csproj">
<Project>{fcf19725-8c2f-44c5-aa52-513ee32469e2}</Project>
<Name>Plugin.Settings.iOSUnified</Name>
<IsAppExtension>false</IsAppExtension>
<IsWatchApp>false</IsWatchApp>
</ProjectReference>
<ProjectReference Include="..\Refractored.Xam.Settings.Tests.Portable\Refractored.Xam.Settings.Tests.Portable.csproj">
<ProjectReference Include="..\Plugin.Settings.Tests.Portable\Plugin.Settings.Tests.Portable.csproj">
<Project>{2961bec8-6e97-4943-af17-491e25309619}</Project>
<Name>Refractored.Xam.Settings.Tests.Portable</Name>
<Name>Plugin.Settings.Tests.Portable</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
</Project>
Loading

0 comments on commit e63c608

Please sign in to comment.