diff --git a/.gitignore b/.gitignore
index 3c4efe2..5f6c6d0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@
*.user
*.userosscache
*.sln.docstates
+*.DS_Store
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
diff --git a/SecureStorageSample/SecureStorageSample.sln b/SecureStorageSample/SecureStorageSample.sln
index 4203939..0d04352 100644
--- a/SecureStorageSample/SecureStorageSample.sln
+++ b/SecureStorageSample/SecureStorageSample.sln
@@ -13,6 +13,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecureStorageSample", "Secu
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecureStorageSample.Mac", "SecureStorageSample\SecureStorageSample.Mac\SecureStorageSample.Mac.csproj", "{298F8069-522F-4EEC-A2BC-99D2568B2193}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecureStorageSampleNUnitTests", "SecureStorageSampleNUnitTests\SecureStorageSampleNUnitTests.csproj", "{8EDF4429-251A-416D-BB68-93F227191BCF}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecureStorageSampleUITest", "SecureStorageSampleUITest\SecureStorageSampleUITest.csproj", "{520AFC3A-9366-4350-BBB4-0EA47CA2D502}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
@@ -189,6 +193,7 @@ Global
{A323FAF1-F514-42E1-A70A-1EE5D0DE55F4}.Debug|ARM.Build.0 = Debug|ARM
{A323FAF1-F514-42E1-A70A-1EE5D0DE55F4}.Debug|ARM.Deploy.0 = Debug|ARM
{A323FAF1-F514-42E1-A70A-1EE5D0DE55F4}.Debug|iPhone.ActiveCfg = Debug|x86
+ {A323FAF1-F514-42E1-A70A-1EE5D0DE55F4}.Debug|iPhone.Build.0 = Debug|x86
{A323FAF1-F514-42E1-A70A-1EE5D0DE55F4}.Debug|iPhoneSimulator.ActiveCfg = Debug|x86
{A323FAF1-F514-42E1-A70A-1EE5D0DE55F4}.Debug|x64.ActiveCfg = Debug|x64
{A323FAF1-F514-42E1-A70A-1EE5D0DE55F4}.Debug|x64.Build.0 = Debug|x64
@@ -304,6 +309,102 @@ Global
{298F8069-522F-4EEC-A2BC-99D2568B2193}.Release|x64.Build.0 = Release|iPhone
{298F8069-522F-4EEC-A2BC-99D2568B2193}.Release|x86.ActiveCfg = Release|iPhone
{298F8069-522F-4EEC-A2BC-99D2568B2193}.Release|x86.Build.0 = Release|iPhone
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Ad-Hoc|ARM.Build.0 = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Ad-Hoc|x64.Build.0 = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Ad-Hoc|x86.Build.0 = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.AppStore|Any CPU.Build.0 = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.AppStore|ARM.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.AppStore|ARM.Build.0 = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.AppStore|iPhone.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.AppStore|iPhone.Build.0 = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.AppStore|x64.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.AppStore|x64.Build.0 = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.AppStore|x86.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.AppStore|x86.Build.0 = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Debug|ARM.Build.0 = Debug|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Debug|x64.Build.0 = Debug|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Debug|x86.Build.0 = Debug|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Release|ARM.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Release|ARM.Build.0 = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Release|iPhone.Build.0 = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Release|x64.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Release|x64.Build.0 = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Release|x86.ActiveCfg = Release|Any CPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}.Release|x86.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Ad-Hoc|ARM.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Ad-Hoc|x64.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Ad-Hoc|x86.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.AppStore|Any CPU.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.AppStore|ARM.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.AppStore|ARM.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.AppStore|iPhone.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.AppStore|iPhone.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.AppStore|x64.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.AppStore|x64.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.AppStore|x86.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.AppStore|x86.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Debug|ARM.Build.0 = Debug|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Debug|x64.Build.0 = Debug|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Debug|x86.Build.0 = Debug|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Release|Any CPU.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Release|ARM.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Release|ARM.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Release|iPhone.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Release|x64.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Release|x64.Build.0 = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Release|x86.ActiveCfg = Release|Any CPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/SecureStorageSample/SecureStorageSample/SecureStorageSample.Android/Properties/AndroidManifest.xml b/SecureStorageSample/SecureStorageSample/SecureStorageSample.Android/Properties/AndroidManifest.xml
index 24fd6c1..72b5433 100644
--- a/SecureStorageSample/SecureStorageSample/SecureStorageSample.Android/Properties/AndroidManifest.xml
+++ b/SecureStorageSample/SecureStorageSample/SecureStorageSample.Android/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
-
-
-
+
+
+
-
+
\ No newline at end of file
diff --git a/SecureStorageSample/SecureStorageSample/SecureStorageSample.Android/SecureStorageSample.Android.csproj b/SecureStorageSample/SecureStorageSample/SecureStorageSample.Android/SecureStorageSample.Android.csproj
index 96aa77f..4f58180 100644
--- a/SecureStorageSample/SecureStorageSample/SecureStorageSample.Android/SecureStorageSample.Android.csproj
+++ b/SecureStorageSample/SecureStorageSample/SecureStorageSample.Android/SecureStorageSample.Android.csproj
@@ -18,6 +18,7 @@
true
+ false
true
@@ -28,6 +29,7 @@
prompt
4
None
+ true
true
@@ -37,7 +39,6 @@
prompt
4
true
- false
@@ -56,7 +57,7 @@
- 2.5.0.122203
+ 2.5.1.444934
diff --git a/SecureStorageSample/SecureStorageSample/SecureStorageSample.Mac/SecureStorageSample.Mac.csproj b/SecureStorageSample/SecureStorageSample/SecureStorageSample.Mac/SecureStorageSample.Mac.csproj
index e2339dd..ffaa54f 100644
--- a/SecureStorageSample/SecureStorageSample/SecureStorageSample.Mac/SecureStorageSample.Mac.csproj
+++ b/SecureStorageSample/SecureStorageSample/SecureStorageSample.Mac/SecureStorageSample.Mac.csproj
@@ -1,6 +1,6 @@
-
+
Debug
iPhone
@@ -59,24 +59,24 @@
- ..\..\packages\sameerIOTApps.Plugin.SecureStorage.2.0.1\lib\Xamarin.Mac\Plugin.SecureStorage.dll
+ ..\..\packages\sameerIOTApps.Plugin.SecureStorage.2.0.0\lib\Xamarin.Mac\Plugin.SecureStorage.dll
- ..\..\packages\sameerIOTApps.Plugin.SecureStorage.2.0.1\lib\Xamarin.Mac\Plugin.SecureStorage.Abstractions.dll
+ ..\..\packages\sameerIOTApps.Plugin.SecureStorage.2.0.0\lib\Xamarin.Mac\Plugin.SecureStorage.Abstractions.dll
- ..\..\packages\Xamarin.Forms.2.5.0.122203\lib\Xamarin.Mac\Xamarin.Forms.Core.dll
+ ..\..\packages\Xamarin.Forms.2.4.0.91020\lib\Xamarin.Mac\Xamarin.Forms.Core.dll
- ..\..\packages\Xamarin.Forms.2.5.0.122203\lib\Xamarin.Mac\Xamarin.Forms.Platform.dll
+ ..\..\packages\Xamarin.Forms.2.4.0.91020\lib\Xamarin.Mac\Xamarin.Forms.Platform.dll
- ..\..\packages\Xamarin.Forms.2.5.0.122203\lib\Xamarin.Mac\Xamarin.Forms.Platform.macOS.dll
+ ..\..\packages\Xamarin.Forms.2.4.0.91020\lib\Xamarin.Mac\Xamarin.Forms.Platform.macOS.dll
- ..\..\packages\Xamarin.Forms.2.5.0.122203\lib\Xamarin.Mac\Xamarin.Forms.Xaml.dll
+ ..\..\packages\Xamarin.Forms.2.4.0.91020\lib\Xamarin.Mac\Xamarin.Forms.Xaml.dll
@@ -124,8 +124,8 @@
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
+
+
-
+
\ No newline at end of file
diff --git a/SecureStorageSample/SecureStorageSample/SecureStorageSample.Mac/packages.config b/SecureStorageSample/SecureStorageSample/SecureStorageSample.Mac/packages.config
index 8c30cf3..38c25b6 100644
--- a/SecureStorageSample/SecureStorageSample/SecureStorageSample.Mac/packages.config
+++ b/SecureStorageSample/SecureStorageSample/SecureStorageSample.Mac/packages.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/SecureStorageSample/SecureStorageSample/SecureStorageSample.UWP/SecureStorageSample.UWP.csproj b/SecureStorageSample/SecureStorageSample/SecureStorageSample.UWP/SecureStorageSample.UWP.csproj
index 35f1804..9682d6e 100644
--- a/SecureStorageSample/SecureStorageSample/SecureStorageSample.UWP/SecureStorageSample.UWP.csproj
+++ b/SecureStorageSample/SecureStorageSample/SecureStorageSample.UWP/SecureStorageSample.UWP.csproj
@@ -151,9 +151,9 @@
2.0.1
-
+
- 2.5.0.122203
+ 2.5.0.280555
diff --git a/SecureStorageSample/SecureStorageSample/SecureStorageSample.iOS/AppDelegate.cs b/SecureStorageSample/SecureStorageSample/SecureStorageSample.iOS/AppDelegate.cs
index d9fee3c..885da7c 100644
--- a/SecureStorageSample/SecureStorageSample/SecureStorageSample.iOS/AppDelegate.cs
+++ b/SecureStorageSample/SecureStorageSample/SecureStorageSample.iOS/AppDelegate.cs
@@ -25,6 +25,12 @@ public override bool FinishedLaunching(UIApplication app, NSDictionary options)
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
+ // Newer version of Visual Studio for Mac and Visual Studio provide the
+ // ENABLE_TEST_CLOUD compiler directive in the Debug configuration,
+ // but not the Release configuration.
+#if ENABLE_TEST_CLOUD
+ Xamarin.Calabash.Start();
+#endif
return base.FinishedLaunching(app, options);
}
}
diff --git a/SecureStorageSample/SecureStorageSample/SecureStorageSample.iOS/Entitlements.plist b/SecureStorageSample/SecureStorageSample/SecureStorageSample.iOS/Entitlements.plist
index b804308..0c67376 100644
--- a/SecureStorageSample/SecureStorageSample/SecureStorageSample.iOS/Entitlements.plist
+++ b/SecureStorageSample/SecureStorageSample/SecureStorageSample.iOS/Entitlements.plist
@@ -1,10 +1,5 @@
-
- keychain-access-groups
-
- com.sameer.SecureStorageSample
-
-
+
diff --git a/SecureStorageSample/SecureStorageSample/SecureStorageSample.iOS/SecureStorageSample.iOS.csproj b/SecureStorageSample/SecureStorageSample/SecureStorageSample.iOS/SecureStorageSample.iOS.csproj
index 54bf563..0496db1 100644
--- a/SecureStorageSample/SecureStorageSample/SecureStorageSample.iOS/SecureStorageSample.iOS.csproj
+++ b/SecureStorageSample/SecureStorageSample/SecureStorageSample.iOS/SecureStorageSample.iOS.csproj
@@ -19,7 +19,7 @@
full
false
bin\iPhoneSimulator\Debug
- DEBUG
+ __IOS__;__MOBILE__;__UNIFIED__;DEBUG;ENABLE_TEST_CLOUD
prompt
4
false
@@ -44,14 +44,15 @@
full
false
bin\iPhone\Debug
- DEBUG
+ __IOS__;__MOBILE__;__UNIFIED__;DEBUG;ENABLE_TEST_CLOUD
prompt
4
false
ARM64
- iPhone Developer
+ iPhone Developer: sxk@hotmail.com (TUC5CDN8PH)
true
Entitlements.plist
+ iOS Team Provisioning Profile: com.sameer.SecureStorageSample
none
@@ -122,10 +123,13 @@
- 2.0.1
+ 2.0.0
+
+
+ 0.21.5
- 2.5.0.122203
+ 2.5.1.444934
diff --git a/SecureStorageSample/SecureStorageSample/SecureStorageSample/App.xaml.cs b/SecureStorageSample/SecureStorageSample/SecureStorageSample/App.xaml.cs
index d2e627d..2218784 100644
--- a/SecureStorageSample/SecureStorageSample/SecureStorageSample/App.xaml.cs
+++ b/SecureStorageSample/SecureStorageSample/SecureStorageSample/App.xaml.cs
@@ -5,6 +5,7 @@
using Xamarin.Forms;
using SecureStorageSample.ViewModels;
+using SecureStorageSample.PlugInServices;
namespace SecureStorageSample
{
@@ -13,11 +14,12 @@ public partial class App : Application
public App()
{
InitializeComponent();
+ RegisterImplementations();
var vm = new MainPageViewModel();
MainPage = new SecureStorageSample.MainPage() { BindingContext = vm };
}
- protected override void OnStart ()
+ protected override void OnStart ()
{
// Handle when your app starts
}
@@ -31,5 +33,10 @@ protected override void OnResume ()
{
// Handle when your app resumes
}
- }
+
+ private void RegisterImplementations()
+ {
+ DependencyService.Register();
+ }
+ }
}
diff --git a/SecureStorageSample/SecureStorageSample/SecureStorageSample/MainPage.xaml b/SecureStorageSample/SecureStorageSample/SecureStorageSample/MainPage.xaml
index d8101aa..1535a87 100644
--- a/SecureStorageSample/SecureStorageSample/SecureStorageSample/MainPage.xaml
+++ b/SecureStorageSample/SecureStorageSample/SecureStorageSample/MainPage.xaml
@@ -20,63 +20,72 @@
+ Grid.Row="0"
+ Grid.Column="0"
+ HorizontalOptions="Center"
+ VerticalOptions="Center"
+ Text="Key" />
+ Grid.Row="0"
+ Grid.Column="1"
+ AutomationId="entryKey"
+ VerticalOptions="Center"
+ Text="{Binding Key, Mode=TwoWay}" />
+ Grid.Row="1"
+ Grid.Column="0"
+ AutomationId="btnSetValue"
+ Text="Set Value"
+ Command="{Binding SetCommand}" />
+ Grid.Row="1"
+ Grid.Column="1"
+ AutomationId="entryValue"
+ Text="{Binding SetVal, Mode=TwoWay}" />
+ Grid.Row="2"
+ Grid.Column="0"
+ AutomationId="btnGetValue"
+ Text="Get Value"
+ Command="{Binding GetCommand}" />
+ Grid.Row="2"
+ Grid.Column="1"
+ AutomationId="lblGetValue"
+ VerticalOptions="Center"
+ Text="{Binding GetVal, Mode=OneWay}" />
+ Grid.Row="3"
+ Grid.Column="0"
+ AutomationId="btnHasCommand"
+ Text="Has Value"
+ Command="{Binding HasCommand}" />
+ Grid.Row="3"
+ Grid.Column="1"
+ AutomationId="lblHasCommand"
+ VerticalOptions="Center"
+ Text="{Binding HasVal, Mode=OneWay}" />
+ Grid.Row="4"
+ Grid.Column="0"
+ AutomationId="btnDelCommand"
+ Text="Delete Key"
+ Command="{Binding DeleteCommand}" />
+ Grid.Row="5"
+ Grid.Column="0"
+ Grid.ColumnSpan="2"
+ AutomationId="lblErrMessage"
+ FontSize="12"
+ MinimumHeightRequest="50"
+ HorizontalOptions="CenterAndExpand"
+ Text="{Binding ErrMessage, Mode=OneWay}" />
diff --git a/SecureStorageSample/SecureStorageSample/SecureStorageSample/PlugInServices/IPluginProvider.cs b/SecureStorageSample/SecureStorageSample/SecureStorageSample/PlugInServices/IPluginProvider.cs
new file mode 100644
index 0000000..59d8861
--- /dev/null
+++ b/SecureStorageSample/SecureStorageSample/SecureStorageSample/PlugInServices/IPluginProvider.cs
@@ -0,0 +1,22 @@
+////////////////////////////////////////////////////////
+// Copyright (c) 2017 Sameer Khandekar //
+// License: MIT License. //
+////////////////////////////////////////////////////////
+using System;
+
+using Plugin.SecureStorage.Abstractions;
+
+namespace SecureStorageSample.PlugInServices
+{
+ ///
+ /// Interface to provide plugin.
+ /// This can be mocked in the unit tests
+ ///
+ public interface IPlugInProvider
+ {
+ ///
+ /// Plugin for secure storage
+ ///
+ ISecureStorage SecureStorage { get; }
+ }
+}
diff --git a/SecureStorageSample/SecureStorageSample/SecureStorageSample/PlugInServices/PlugInProvider.cs b/SecureStorageSample/SecureStorageSample/SecureStorageSample/PlugInServices/PlugInProvider.cs
new file mode 100644
index 0000000..a7e7104
--- /dev/null
+++ b/SecureStorageSample/SecureStorageSample/SecureStorageSample/PlugInServices/PlugInProvider.cs
@@ -0,0 +1,22 @@
+////////////////////////////////////////////////////////
+// Copyright (c) 2017 Sameer Khandekar //
+// License: MIT License. //
+////////////////////////////////////////////////////////
+using System;
+
+using Plugin.SecureStorage;
+using Plugin.SecureStorage.Abstractions;
+
+namespace SecureStorageSample.PlugInServices
+{
+ ///
+ /// Provider for plugin
+ ///
+ public class PlugInProvider : IPlugInProvider
+ {
+ ///
+ /// SecureStorage plugin
+ ///
+ public ISecureStorage SecureStorage => CrossSecureStorage.Current;
+ }
+}
diff --git a/SecureStorageSample/SecureStorageSample/SecureStorageSample/SecureStorageSample.csproj b/SecureStorageSample/SecureStorageSample/SecureStorageSample/SecureStorageSample.csproj
index b7f3f3c..d95bd4a 100644
--- a/SecureStorageSample/SecureStorageSample/SecureStorageSample/SecureStorageSample.csproj
+++ b/SecureStorageSample/SecureStorageSample/SecureStorageSample/SecureStorageSample.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/SecureStorageSample/SecureStorageSample/SecureStorageSample/ViewModels/MainPageViewModel.cs b/SecureStorageSample/SecureStorageSample/SecureStorageSample/ViewModels/MainPageViewModel.cs
index dd70016..bb3ae25 100644
--- a/SecureStorageSample/SecureStorageSample/SecureStorageSample/ViewModels/MainPageViewModel.cs
+++ b/SecureStorageSample/SecureStorageSample/SecureStorageSample/ViewModels/MainPageViewModel.cs
@@ -9,7 +9,8 @@
using Xamarin.Forms;
-using Plugin.SecureStorage;
+using Plugin.SecureStorage.Abstractions;
+using SecureStorageSample.PlugInServices;
namespace SecureStorageSample.ViewModels
{
@@ -20,6 +21,9 @@ public class MainPageViewModel : INotifyPropertyChanged
{
public MainPageViewModel()
{
+ // get the secure storage
+ _secureStorage = DependencyService.Get().SecureStorage;
+
SetCommand = new Command(ExecuteSetCommand);
GetCommand = new Command(ExecuteGetCommand);
HasCommand = new Command(ExecuteHasCommand);
@@ -140,7 +144,7 @@ private void ExecuteSetCommand(object sender)
ErrMessage = string.Empty;
try
{
- CrossSecureStorage.Current.SetValue(Key, SetVal);
+ _secureStorage.SetValue(Key, SetVal);
}
catch (Exception ex)
{
@@ -153,7 +157,7 @@ private void ExecuteGetCommand(object sender)
ErrMessage = string.Empty;
try
{
- GetVal = CrossSecureStorage.Current.GetValue(Key);
+ GetVal = _secureStorage.GetValue(Key);
}
catch (Exception ex)
{
@@ -166,7 +170,7 @@ private void ExecuteHasCommand(object sender)
ErrMessage = string.Empty;
try
{
- HasVal = CrossSecureStorage.Current.HasKey(Key) ? "Y" : "N";
+ HasVal = _secureStorage.HasKey(Key) ? "Y" : "N";
}
catch (Exception ex)
{
@@ -179,9 +183,13 @@ private void ExecuteDeleteCommand(object sender)
ErrMessage = string.Empty;
try
{
- CrossSecureStorage.Current.DeleteKey(Key);
- GetVal = string.Empty;
- HasVal = string.Empty;
+ bool success = _secureStorage.DeleteKey(Key);
+ ErrMessage = success.ToString();
+ if (success)
+ {
+ GetVal = string.Empty;
+ HasVal = string.Empty;
+ }
}
catch (Exception ex)
{
@@ -202,5 +210,12 @@ private void RaisePropertyChanged([CallerMemberName]string propertyName = "")
public event PropertyChangedEventHandler PropertyChanged;
#endregion
+
+ #region private fields
+ ///
+ /// Storage plugin
+ ///
+ private readonly ISecureStorage _secureStorage;
+ #endregion
}
}
diff --git a/SecureStorageSample/SecureStorageSampleNUnitTests/MainViewModelUnitTest.cs b/SecureStorageSample/SecureStorageSampleNUnitTests/MainViewModelUnitTest.cs
new file mode 100644
index 0000000..de9027c
--- /dev/null
+++ b/SecureStorageSample/SecureStorageSampleNUnitTests/MainViewModelUnitTest.cs
@@ -0,0 +1,241 @@
+using System;
+using System.Collections.Generic;
+using NUnit.Framework;
+using SecureStorageSample.PlugInServices;
+using SecureStorageSample.ViewModels;
+using SecureStorageSampleNUnitTests.Mocks;
+using UnitTestSample.Mocks;
+using Xamarin.Forms;
+
+namespace SecureStorageSampleNUnitTests
+{
+ ///
+ /// Unit test class
+ ///
+ [TestFixture]
+ public class MainViewModelUnitTest
+ {
+ ///
+ /// One time setup
+ ///
+ [OneTimeSetUp]
+ public void InitOnce()
+ {
+ // init Xamarin forms mocks
+ Xamarin.Forms.Mocks.MockForms.Init();
+ RegisterImplementations();
+ }
+
+ ///
+ /// Runs prior to each test
+ ///
+ [SetUp]
+ public void InitTest()
+ {
+ var plugInProvider = DependencyService.Get();
+ UnitTestDataStore = ((SecureStorageMock)plugInProvider.SecureStorage).MockStorage;
+ // clear before each test
+ UnitTestDataStore.Clear();
+ _viewModel = new MainPageViewModel();
+ }
+
+ #region SetCommand UnitTests
+ ///
+ /// Verify that SetCommand stores data as expected.
+ ///
+ [Test]
+ public void SetCommand_WithValidValue_StoresValue()
+ {
+ // Arrange
+ _viewModel.SetVal = ValidTestValue;
+ _viewModel.Key = ValidTestKey;
+
+ // Act
+ _viewModel.SetCommand.Execute(null);
+
+ // Assert
+ Assert.AreEqual(ValidTestValue, UnitTestDataStore[ValidTestKey]);
+ }
+
+ ///
+ /// Verify that when innvalid key is used in SetCommand, error message is displayed
+ ///
+ [Test]
+ public void SetCommand_WithInvalidKey_SetsErrMesage()
+ {
+ // Arrange
+ _viewModel.SetVal = ValidTestValue;
+ _viewModel.Key = string.Empty;
+
+ // Act
+ _viewModel.SetCommand.Execute(null);
+
+ // Assert
+ Assert.IsFalse(string.IsNullOrEmpty(_viewModel.ErrMessage));
+ }
+ #endregion
+
+ #region GetCommand UnitTests
+ ///
+ /// Validate that the GetCommand loads valid value in the view model
+ ///
+ [Test]
+ public void GetComand_WithValidKey_ReturnsCorrectValue()
+ {
+ // Arrange
+ UnitTestDataStore[ValidTestKey] = ValidTestValue;
+ _viewModel.Key = ValidTestKey;
+
+ // Act
+ _viewModel.GetCommand.Execute(null);
+
+ // Assert
+ Assert.AreEqual(ValidTestValue, _viewModel.GetVal);
+ }
+
+ ///
+ /// Verify that when innvalid key is used in GetCommand, error message is displayed
+ ///
+ [Test]
+ public void GetComand_WithInvalidKey_DisplaysErrorMessage()
+ {
+ // Arrange
+ _viewModel.Key = string.Empty;
+
+ // Act
+ _viewModel.GetCommand.Execute(null);
+
+ // Assert
+ Assert.IsFalse(string.IsNullOrEmpty(_viewModel.ErrMessage));
+ }
+ #endregion
+
+ #region HasCommand UnitTests
+ ///
+ /// Validate that the HasCommand sets "Y" in HasVal in the view model
+ /// When value is present
+ ///
+ [Test]
+ public void HasComand_WithExistingKey_ReturnsY()
+ {
+ // Arrange
+ UnitTestDataStore[ValidTestKey] = ValidTestValue;
+ _viewModel.Key = ValidTestKey;
+
+ // Act
+ _viewModel.HasCommand.Execute(null);
+
+ // Assert
+ Assert.AreEqual("Y", _viewModel.HasVal);
+ }
+
+ ///
+ /// Validate that the HasCommand sets "N" in HasVal in the view model
+ /// When value is present
+ ///
+ [Test]
+ public void HasComand_WithNonExistingKey_ReturnsN()
+ {
+ // Arrange
+ _viewModel.Key = "NotExistingKey";
+
+ // Act
+ _viewModel.HasCommand.Execute(null);
+
+ // Assert
+ Assert.AreEqual("N", _viewModel.HasVal);
+ }
+
+ ///
+ /// Verify that when innvalid key is used in GetCommand, error message is displayed
+ ///
+ [Test]
+ public void HasComand_WithInvalidKey_DisplaysErrorMessage()
+ {
+ // Arrange
+ _viewModel.Key = string.Empty;
+
+ // Act
+ _viewModel.HasCommand.Execute(null);
+
+ // Assert
+ Assert.IsFalse(string.IsNullOrEmpty(_viewModel.ErrMessage));
+ }
+ #endregion
+
+ #region DeleteCommand UnitTests
+ ///
+ /// Validate that the DeleteCommand sets "True" in ErrMessage in the view model
+ /// When key is present
+ ///
+ [Test]
+ public void DeleteComand_WithExistingKey_ReturnsTrue()
+ {
+ // Arrange
+ UnitTestDataStore[ValidTestKey] = ValidTestValue;
+ _viewModel.Key = ValidTestKey;
+
+ // Act
+ _viewModel.DeleteCommand.Execute(null);
+
+ // Assert
+ Assert.AreEqual(true.ToString(), _viewModel.ErrMessage);
+ }
+
+ ///
+ /// Validate that the DeleteCommand sets "False" in ErrMessage in the view model
+ /// When key is not present
+ ///
+ [Test]
+ public void DeleteComand_WithNonExistingKey_ReturnsN()
+ {
+ // Arrange
+ _viewModel.Key = "NotExistingKey";
+
+ // Act
+ _viewModel.DeleteCommand.Execute(null);
+
+ // Assert
+ Assert.AreEqual(false.ToString(), _viewModel.ErrMessage);
+ }
+
+ ///
+ /// Verify that when innvalid key is used in DeleteCommand, error message is displayed
+ ///
+ [Test]
+ public void DeleteComand_WithInvalidKey_DisplaysErrorMessage()
+ {
+ // Arrange
+ _viewModel.Key = string.Empty;
+
+ // Act
+ _viewModel.DeleteCommand.Execute(null);
+
+ // Assert
+ Assert.IsFalse(string.IsNullOrEmpty(_viewModel.ErrMessage));
+ }
+ #endregion
+
+ #region private methods
+ ///
+ /// register the mock provider
+ ///
+ private void RegisterImplementations()
+ {
+ DependencyService.Register();
+ }
+ #endregion
+ ///
+ /// ViewModel that will be tested using mock
+ ///
+ private MainPageViewModel _viewModel;
+
+ private Dictionary UnitTestDataStore;
+ // private SecureStorageMock UnitTestDataStore;
+
+ #region consts
+ const string ValidTestValue = "1234";
+ const string ValidTestKey = "FooKey";
+ #endregion
+ }
+}
diff --git a/SecureStorageSample/SecureStorageSampleNUnitTests/Mocks/PluginProviderMock.cs b/SecureStorageSample/SecureStorageSampleNUnitTests/Mocks/PluginProviderMock.cs
new file mode 100644
index 0000000..91eb1ef
--- /dev/null
+++ b/SecureStorageSample/SecureStorageSampleNUnitTests/Mocks/PluginProviderMock.cs
@@ -0,0 +1,26 @@
+////////////////////////////////////////////////////////
+// Copyright (c) 2017 Sameer Khandekar //
+// License: MIT License. //
+////////////////////////////////////////////////////////
+using System;
+using Plugin.SecureStorage.Abstractions;
+using SecureStorageSample.PlugInServices;
+using UnitTestSample.Mocks;
+
+namespace SecureStorageSampleNUnitTests.Mocks
+{
+ ///
+ /// This is a provider for one or more plugins
+ ///
+ public class PluginProviderMock : IPlugInProvider
+ {
+ #region IPlugInProvider implementation
+ ///
+ /// Secure storage
+ ///
+ public ISecureStorage SecureStorage => _secureStorageMock;
+ #endregion
+
+ private SecureStorageMock _secureStorageMock = new SecureStorageMock();
+ }
+}
diff --git a/SecureStorageSample/SecureStorageSampleNUnitTests/Mocks/SecureStorageMock.cs b/SecureStorageSample/SecureStorageSampleNUnitTests/Mocks/SecureStorageMock.cs
new file mode 100644
index 0000000..5989276
--- /dev/null
+++ b/SecureStorageSample/SecureStorageSampleNUnitTests/Mocks/SecureStorageMock.cs
@@ -0,0 +1,85 @@
+////////////////////////////////////////////////////////
+// Copyright (c) 2017 Sameer Khandekar //
+// License: MIT License. //
+////////////////////////////////////////////////////////
+using System;
+using System.Collections.Generic;
+using Plugin.SecureStorage.Abstractions;
+
+namespace UnitTestSample.Mocks
+{
+ public class SecureStorageMock : SecureStorageImplementationBase
+ {
+ ///
+ /// Sets/overrides value for the given key
+ ///
+ ///
+ ///
+ ///
+ public override bool SetValue(string key, string value)
+ {
+ base.SetValue(key, value);
+
+ MockStorage[key] = value;
+
+ return true;
+ }
+
+ ///
+ /// Returns value for the given key.
+ /// If the key does not exists, returns the value indicated by defaultValue parameter
+ ///
+ ///
+ ///
+ ///
+ public override string GetValue(string key, string defaultValue = null)
+ {
+ base.GetValue(key, defaultValue);
+
+ if (MockStorage.ContainsKey(key))
+ {
+ return MockStorage[key];
+ }
+
+ return defaultValue;
+ }
+
+ ///
+ /// Checks if the key has any value set
+ ///
+ ///
+ ///
+ public override bool HasKey(string key)
+ {
+ base.HasKey(key);
+
+ return MockStorage.ContainsKey(key);
+ }
+
+ ///
+ /// Deletes key from the collection, if it exists
+ /// Returns true, if the key exists. False, if it does not exist
+ ///
+ ///
+ ///
+ public override bool DeleteKey(string key)
+ {
+ base.DeleteKey(key);
+
+ if (MockStorage.ContainsKey(key))
+ {
+ MockStorage.Remove(key);
+
+ return true;
+ }
+
+ return false;
+ }
+
+ ///
+ /// Mock storage to store data
+ /// Values in this storage can be used to verify
+ ///
+ public Dictionary MockStorage { get; } = new Dictionary();
+ }
+}
diff --git a/SecureStorageSample/SecureStorageSampleNUnitTests/Properties/AssemblyInfo.cs b/SecureStorageSample/SecureStorageSampleNUnitTests/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..74679d7
--- /dev/null
+++ b/SecureStorageSample/SecureStorageSampleNUnitTests/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
+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("SecureStorageSampleNUnitTests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("nunit.tests")]
+[assembly: AssemblyCopyright("Copyright © 2017")]
+[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)]
+
+// 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/SecureStorageSample/SecureStorageSampleNUnitTests/SecureStorageSampleNUnitTests.csproj b/SecureStorageSample/SecureStorageSampleNUnitTests/SecureStorageSampleNUnitTests.csproj
new file mode 100644
index 0000000..76b1da4
--- /dev/null
+++ b/SecureStorageSample/SecureStorageSampleNUnitTests/SecureStorageSampleNUnitTests.csproj
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+ Debug
+ AnyCPU
+ {8EDF4429-251A-416D-BB68-93F227191BCF}
+ Library
+ Properties
+ SecureStorageSampleNUnitTests
+ SecureStorageSampleNUnitTests
+ v4.6.1
+ 512
+
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\NUnit.3.10.1\lib\net45\nunit.framework.dll
+
+
+ ..\packages\sameerIOTApps.Plugin.SecureStorage.2.0.1\lib\netstandard1.0\Plugin.SecureStorage.dll
+
+
+ ..\packages\sameerIOTApps.Plugin.SecureStorage.2.0.1\lib\netstandard1.0\Plugin.SecureStorage.Abstractions.dll
+
+
+
+ ..\packages\Xamarin.Forms.Mocks.2.5.0.4\lib\netstandard2.0\Xamarin.Forms.Core.UnitTests.dll
+
+
+ ..\packages\Xamarin.Forms.Mocks.2.5.0.4\lib\netstandard2.0\Xamarin.Forms.Xaml.UnitTests.dll
+
+
+ ..\packages\Xamarin.Forms.2.5.1.444934\lib\netstandard1.0\Xamarin.Forms.Core.dll
+
+
+ ..\packages\Xamarin.Forms.2.5.1.444934\lib\netstandard1.0\Xamarin.Forms.Platform.dll
+
+
+ ..\packages\Xamarin.Forms.2.5.1.444934\lib\netstandard1.0\Xamarin.Forms.Xaml.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {0fe0c4bc-60a6-47e8-ad7b-65142bd92448}
+ SecureStorageSample
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
\ No newline at end of file
diff --git a/SecureStorageSample/SecureStorageSampleNUnitTests/packages.config b/SecureStorageSample/SecureStorageSampleNUnitTests/packages.config
new file mode 100644
index 0000000..f44f204
--- /dev/null
+++ b/SecureStorageSample/SecureStorageSampleNUnitTests/packages.config
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SecureStorageSample/SecureStorageSampleUITest/AppInitializer.cs b/SecureStorageSample/SecureStorageSampleUITest/AppInitializer.cs
new file mode 100644
index 0000000..f52dbe3
--- /dev/null
+++ b/SecureStorageSample/SecureStorageSampleUITest/AppInitializer.cs
@@ -0,0 +1,32 @@
+using System;
+using System.IO;
+using System.Linq;
+using Xamarin.UITest;
+using Xamarin.UITest.Queries;
+
+namespace SecureStorageSampleUITest
+{
+ public class AppInitializer
+ {
+ public static IApp StartApp(Platform platform)
+ {
+ if (platform == Platform.Android)
+ {
+ return ConfigureApp
+ .Android
+ .ApkFile("../../../SecureStorageSample/SecureStorageSample.Android/bin/Debug/com.companyname.SecureStorageSample.apk")
+ .StartApp();
+ }
+
+ // for iOS add reference to the project and
+ // adjusted this as per your settings for iOS
+ const string simId = "1B7659DC-8BB3-4F26-A84E-7D2B8321F7DB"; //iPhone 5s (11.3 Simulator)
+ return ConfigureApp
+ .iOS
+ .AppBundle("../../../SecureStorageSample/SecureStorageSample.iOS/bin/iPhoneSimulator/Debug/device-builds/iphone6.1-11.3/SecureStorageSample.iOS.app")
+ .DeviceIdentifier(simId)
+ .StartApp();
+ }
+ }
+}
+
diff --git a/SecureStorageSample/SecureStorageSampleUITest/SecureStorageSampleUITest.csproj b/SecureStorageSample/SecureStorageSampleUITest/SecureStorageSampleUITest.csproj
new file mode 100644
index 0000000..cbe2304
--- /dev/null
+++ b/SecureStorageSample/SecureStorageSampleUITest/SecureStorageSampleUITest.csproj
@@ -0,0 +1,60 @@
+
+
+
+ Debug
+ AnyCPU
+ {520AFC3A-9366-4350-BBB4-0EA47CA2D502}
+ Library
+ SecureStorageSampleUITest
+ SecureStorageSampleUITest
+ v4.6.1
+
+
+ true
+ full
+ false
+ bin\Debug
+ DEBUG;
+ prompt
+ 4
+ false
+
+
+ full
+ true
+ bin\Release
+ prompt
+ 4
+ false
+
+
+
+
+ ..\packages\NUnit.2.6.3\lib\nunit.framework.dll
+
+
+ ..\packages\Xamarin.UITest.2.2.4\lib\net45\Xamarin.UITest.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {0cd6d3b1-026f-4935-bcd8-37b3ab496693}
+ SecureStorageSample.Android
+
+
+ {0fe0c4bc-60a6-47e8-ad7b-65142bd92448}
+ SecureStorageSample
+
+
+
+
\ No newline at end of file
diff --git a/SecureStorageSample/SecureStorageSampleUITest/Tests.cs b/SecureStorageSample/SecureStorageSampleUITest/Tests.cs
new file mode 100644
index 0000000..84f750e
--- /dev/null
+++ b/SecureStorageSample/SecureStorageSampleUITest/Tests.cs
@@ -0,0 +1,151 @@
+////////////////////////////////////////////////////////
+// Copyright (c) 2017 Sameer Khandekar //
+// License: MIT License. //
+////////////////////////////////////////////////////////
+
+using System;
+using System.Linq;
+using NUnit.Framework;
+using Xamarin.UITest;
+using Xamarin.UITest.Queries;
+
+namespace SecureStorageSampleUITest
+{
+ ///
+ /// Class for testing
+ ///
+ [TestFixture(Platform.Android)]
+ // [TestFixture(Platform.iOS)] Make changes to AppInitializer for iOS and then Uncomment this
+ public class Tests
+ {
+ IApp app;
+ Platform platform;
+ ///
+ /// Constructor
+ ///
+ ///
+ public Tests(Platform platform)
+ {
+ this.platform = platform;
+ }
+
+ ///
+ /// Start App prior to each test
+ ///
+ [SetUp]
+ public void BeforeEachTest()
+ {
+ app = AppInitializer.StartApp(platform);
+ }
+
+ ///
+ /// Test HasValue for non-existing value
+ ///
+ [Test]
+ public void HasValue_WithNonExistingKey_ReturnsFalse()
+ {
+ // Arrange - just type the key, do not add
+ app.EnterText("entryKey", "ABC");
+
+ // Act - Tap Has button
+ app.Tap("btnHasCommand");
+
+ // Assert
+ var result = app.Query(c => c.Marked("lblHasCommand").Text("N"));
+ Assert.IsTrue(result.Any(), "HasValue_WithNonExistingKey Failed");
+ }
+
+ ///
+ /// Test HasValue for an existing value shows Y
+ ///
+ [Test]
+ public void HasValue_WithExistingKey_ReturnsTrue()
+ {
+ // Arrange - store a value with key
+ app.EnterText("entryKey", "ABC");
+ app.EnterText("entryValue", "XYZ");
+ app.Tap("btnSetValue");
+
+ // Act - Tap the button
+ app.Tap("btnHasCommand");
+
+ // Assert - should show Y
+ var result = app.Query(c => c.Marked("lblHasCommand").Text("Y"));
+ Assert.IsTrue(result.Any(), "HasValue_WithExistingKey Failed");
+ }
+
+ ///
+ /// Attempt to get value for non-existing key returns default
+ ///
+ [Test]
+ public void GetValue_WithNonExistingKey_ReturnsDefault()
+ {
+ // Arrange - just type the key, do not add
+ app.EnterText("entryKey", "ABC");
+
+ // Act - Tap Get button
+ app.Tap("btnGetValue");
+
+ // Assert
+ var result = app.Query(c => c.Marked("lblGetValue").Text(""));
+ Assert.IsTrue(result.Any(), "GetValue_WithNonExistingKey Failed");
+ }
+
+ ///
+ /// Get value for existing key returns stored value
+ ///
+ [Test]
+ public void GetValue_WithExistingKey_ReturnsStored()
+ {
+ // Arrange - store a value with key
+ app.EnterText("entryKey", "ABC");
+ app.EnterText("entryValue", "XYZ");
+ app.Tap("btnSetValue");
+
+ // Act - Tap the button
+ app.Tap("btnGetValue");
+
+ // Assert - should show XYZ
+ var result = app.Query(c => c.Marked("lblGetValue").Text("XYZ"));
+ Assert.IsTrue(result.Any(), "GetValue_WithExistingKey Failed");
+ }
+
+ ///
+ /// Attempt to delete non-existing key returns false
+ ///
+ [Test]
+ public void DeleteKey_WithNonExistingKey_ReturnsFalse()
+ {
+ // Arrange - just type the key, do not add
+ app.EnterText("entryKey", "ABC");
+
+ // Act - Tap Delete button
+ app.Tap("btnDelCommand");
+
+ // Assert
+ var result = app.Query(c => c.Marked("lblErrMessage").Text("False"));
+ Assert.IsTrue(result.Any(), "DeleteKey_WithNonExistingKey Failed");
+ }
+
+ ///
+ /// Attempt to delete existing key returns true
+ ///
+ [Test]
+ public void DeleteKey_WithExistingKey_ReturnsTrue()
+ {
+ // Arrange - store a value with key
+ app.EnterText("entryKey", "ABC");
+ app.EnterText("entryValue", "XYZ");
+ app.Tap("btnSetValue");
+
+ // Act - Tap the delete button
+ app.Tap("btnDelCommand");
+
+ // Assert - should show True
+ app.WaitForElement(c => c.Marked("lblErrMessage").Text("True"));
+ var result = app.Query(c => c.Marked("lblErrMessage").Text("True"));
+ Assert.IsTrue(result.Any(), "DeleteKey_WithExistingKey Failed");
+ }
+ }
+}
+
diff --git a/SecureStorageSample/SecureStorageSampleUITest/packages.config b/SecureStorageSample/SecureStorageSampleUITest/packages.config
new file mode 100644
index 0000000..b5e5b8c
--- /dev/null
+++ b/SecureStorageSample/SecureStorageSampleUITest/packages.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file