public static ZumoTestGroup CreateTests() { ZumoTestGroup result = new ZumoTestGroup("Login tests"); result.AddTest(CreateLogoutTest()); result.AddTest(CreateCRUDTest(TablePublicPermission, null, TablePermission.Public, false)); result.AddTest(CreateCRUDTest(TableApplicationPermission, null, TablePermission.Application, false)); result.AddTest(CreateCRUDTest(TableUserPermission, null, TablePermission.User, false)); result.AddTest(CreateCRUDTest(TableAdminPermission, null, TablePermission.Admin, false)); int indexOfTestsWithAuthentication = result.AllTests.Count(); Dictionary <MobileServiceAuthenticationProvider, bool> providersWithRecycledTokenSupport; providersWithRecycledTokenSupport = new Dictionary <MobileServiceAuthenticationProvider, bool> { { MobileServiceAuthenticationProvider.Facebook, true }, { MobileServiceAuthenticationProvider.Google, false }, // Known bug - Drop login via Google token until Google client flow is reintroduced { MobileServiceAuthenticationProvider.MicrosoftAccount, false }, { MobileServiceAuthenticationProvider.Twitter, false }, { MobileServiceAuthenticationProvider.WindowsAzureActiveDirectory, false } }; #if !WINDOWS_PHONE result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("In the next few tests you will be prompted for username / password five times.")); #endif foreach (MobileServiceAuthenticationProvider provider in Util.EnumGetValues(typeof(MobileServiceAuthenticationProvider))) { result.AddTest(CreateLogoutTest()); #if !WINDOWS_PHONE result.AddTest(CreateLoginTest(provider, false)); #else result.AddTest(CreateLoginTest(provider)); #endif result.AddTest(CreateCRUDTest(TableApplicationPermission, provider.ToString(), TablePermission.Application, true)); result.AddTest(CreateCRUDTest(TableUserPermission, provider.ToString(), TablePermission.User, true)); result.AddTest(CreateCRUDTest(TableAdminPermission, provider.ToString(), TablePermission.Admin, true)); bool supportsTokenRecycling; if (providersWithRecycledTokenSupport.TryGetValue(provider, out supportsTokenRecycling) && supportsTokenRecycling) { result.AddTest(CreateLogoutTest()); result.AddTest(CreateClientSideLoginTest(provider)); result.AddTest(CreateCRUDTest(TableUserPermission, provider.ToString(), TablePermission.User, userIsAuthenticated: true, usingSingleSignOnOrToken: true)); } } #if !WINDOWS_PHONE result.AddTest(ZumoTestCommon.CreateYesNoTest("Were you prompted for username / password five times?", true)); #endif result.AddTest(CreateLogoutTest()); #if WINDOWS_PHONE && !WP75 result.AddTest(ZumoTestCommon.CreateInputTest("Enter Live App Client ID", testPropertyBag, ClientIdKeyName)); #endif #if !WP75 result.AddTest(CreateLiveSDKLoginTest()); result.AddTest(CreateCRUDTest(TableUserPermission, MicrosoftViaLiveSDK, TablePermission.User, true)); #endif #if !WINDOWS_PHONE result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("We'll log in again; you may or may not be asked for password in the next few moments.")); foreach (MobileServiceAuthenticationProvider provider in Enum.GetValues(typeof(MobileServiceAuthenticationProvider))) { if (provider == MobileServiceAuthenticationProvider.MicrosoftAccount) { // Known issue - SSO with MS account will not work if Live SDK is also used continue; } result.AddTest(CreateLogoutTest()); result.AddTest(CreateLoginTest(provider, true)); result.AddTest(CreateCRUDTest(TableUserPermission, provider.ToString(), TablePermission.User, userIsAuthenticated: true, usingSingleSignOnOrToken: true)); } result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("Now we'll continue running the tests, but you *should not be prompted for the username or password anymore*.")); foreach (MobileServiceAuthenticationProvider provider in Enum.GetValues(typeof(MobileServiceAuthenticationProvider))) { if (provider == MobileServiceAuthenticationProvider.MicrosoftAccount) { // Known issue - SSO with MS account will not work if Live SDK is also used continue; } result.AddTest(CreateLogoutTest()); result.AddTest(CreateLoginTest(provider, true)); result.AddTest(CreateCRUDTest(TableUserPermission, provider.ToString(), TablePermission.User, userIsAuthenticated: true, usingSingleSignOnOrToken: true)); } result.AddTest(ZumoTestCommon.CreateYesNoTest("Were you prompted for the username in any of the providers?", false)); #endif foreach (var test in result.AllTests.Skip(indexOfTestsWithAuthentication)) { test.CanRunUnattended = false; } // Clean-up any logged in user result.AddTest(CreateLogoutTest()); return(result); }
public static ZumoTestGroup CreateTests() { ZumoTestGroup result = new ZumoTestGroup("Login tests"); result.AddTest(CreateLogoutTest()); result.AddTest(CreateCRUDTest(TablePublicPermission, null, TablePermission.Public, false)); result.AddTest(CreateCRUDTest(TableApplicationPermission, null, TablePermission.Application, false)); result.AddTest(CreateCRUDTest(TableUserPermission, null, TablePermission.User, false)); result.AddTest(CreateCRUDTest(TableAdminPermission, null, TablePermission.Admin, false)); Dictionary <MobileServiceAuthenticationProvider, bool> providersWithRecycledTokenSupport; providersWithRecycledTokenSupport = new Dictionary <MobileServiceAuthenticationProvider, bool> { { MobileServiceAuthenticationProvider.Facebook, true }, { MobileServiceAuthenticationProvider.Google, true }, { MobileServiceAuthenticationProvider.MicrosoftAccount, false }, { MobileServiceAuthenticationProvider.Twitter, false }, }; #if !WINDOWS_PHONE result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("In the next few tests you will be prompted for username / password four times.")); #endif foreach (MobileServiceAuthenticationProvider provider in Util.EnumGetValues(typeof(MobileServiceAuthenticationProvider))) { result.AddTest(CreateLogoutTest()); #if !WINDOWS_PHONE result.AddTest(CreateLoginTest(provider, false)); #else result.AddTest(CreateLoginTest(provider)); #endif result.AddTest(CreateCRUDTest(TableApplicationPermission, provider.ToString(), TablePermission.Application, true)); result.AddTest(CreateCRUDTest(TableUserPermission, provider.ToString(), TablePermission.User, true)); result.AddTest(CreateCRUDTest(TableAdminPermission, provider.ToString(), TablePermission.Admin, true)); bool supportsTokenRecycling; if (providersWithRecycledTokenSupport.TryGetValue(provider, out supportsTokenRecycling) && supportsTokenRecycling) { result.AddTest(CreateLogoutTest()); result.AddTest(CreateClientSideLoginTest(provider)); result.AddTest(CreateCRUDTest(TableUserPermission, provider.ToString(), TablePermission.User, true)); } } #if !WINDOWS_PHONE result.AddTest(ZumoTestCommon.CreateYesNoTest("Were you prompted for username / password four times?", true)); #endif result.AddTest(CreateLogoutTest()); #if WINDOWS_PHONE && !WP75 result.AddTest(ZumoTestCommon.CreateInputTest("Enter Live App Client ID", testPropertyBag, ClientIdKeyName)); #endif #if !WP75 result.AddTest(CreateLiveSDKLoginTest()); result.AddTest(CreateCRUDTest(TableUserPermission, "Microsoft via Live SDK", TablePermission.User, true)); #endif #if !WINDOWS_PHONE result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("We'll log in again; you may or may not be asked for password in the next few moments.")); foreach (MobileServiceAuthenticationProvider provider in Enum.GetValues(typeof(MobileServiceAuthenticationProvider))) { if (provider == MobileServiceAuthenticationProvider.MicrosoftAccount) { // Known issue - SSO with MS account will not work if Live SDK is also used continue; } result.AddTest(CreateLogoutTest()); result.AddTest(CreateLoginTest(provider, true)); result.AddTest(CreateCRUDTest(TableUserPermission, provider.ToString(), TablePermission.User, true)); } result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("Now we'll continue running the tests, but you *should not be prompted for the username or password anymore*.")); foreach (MobileServiceAuthenticationProvider provider in Enum.GetValues(typeof(MobileServiceAuthenticationProvider))) { if (provider == MobileServiceAuthenticationProvider.MicrosoftAccount) { // Known issue - SSO with MS account will not work if Live SDK is also used continue; } result.AddTest(CreateLogoutTest()); result.AddTest(CreateLoginTest(provider, true)); result.AddTest(CreateCRUDTest(TableUserPermission, provider.ToString(), TablePermission.User, true)); } result.AddTest(ZumoTestCommon.CreateYesNoTest("Were you prompted for the username in any of the providers?", false)); #endif return(result); }