public static void ClassSetup(TestContext context)
 {
     SFApplicationHelper.RegisterServices();
     SDKServiceLocator.RegisterService <ILoggingService, Hybrid.Logging.Logger>();
     Store = SmartStore.GetGlobalSmartStore();
     SetupData();
 }
 public static void TestSetup(TestContext context)
 {
     SFApplicationHelper.RegisterServices();
     SDKServiceLocator.RegisterService <ILoggingService, Hybrid.Logging.Logger>();
     Store = SmartStore.GetGlobalSmartStore();
     Store.ResetDatabase();
     Store.RegisterSoup(TEST_SOUP, new[] { new IndexSpec("key", SmartStoreType.SmartString) });
 }
        public static async Task TestSetup(TestContext context)
        {
            var settings = new EncryptionSettings(new HmacSHA256KeyGenerator());

            Encryptor.init(settings);
            var options = new LoginOptions(TestCredentials.LoginUrl, TestCredentials.ClientId, TestCallbackUrl, "mobile",
                                           TestScopes);
            var response = new AuthResponse
            {
                RefreshToken = TestCredentials.RefreshToken,
                AccessToken  = TestAuthToken,
                InstanceUrl  = TestCredentials.InstanceUrl,
                IdentityUrl  = TestCredentials.IdentityUrl,
                Scopes       = TestScopes,
            };
            Account account = await AccountManager.CreateNewAccount(options, response);

            account.UserId   = TestCredentials.UserId;
            account.UserName = TestCredentials.Username;
            await OAuth2.RefreshAuthToken(account);

            _smartStore = SmartStore.GetGlobalSmartStore();
            _smartStore.ResetDatabase();
            _syncManager = SyncManager.GetInstance();
            _restClient  = new RestClient(account.InstanceUrl, account.AccessToken,
                                          async() =>
            {
                account = AccountManager.GetAccount();
                AuthResponse authResponse =
                    await OAuth2.RefreshAuthTokenRequest(account.GetLoginOptions(), account.RefreshToken);
                account.AccessToken = authResponse.AccessToken;
                return(account.AccessToken);
            }
                                          );
            CreateAccountsSoup();
            _idToNames = await CreateTestAccountsOnServer(CountTestAccounts);
        }
Пример #4
0
 public static void TestSetup(TestContext context)
 {
     Store = SmartStore.GetGlobalSmartStore();
     Store.ResetDatabase();
     Store.RegisterSoup(TEST_SOUP, new[] { new IndexSpec("key", SmartStoreType.SmartString) });
 }
Пример #5
0
 public async static Task TestSetup(TestContext context)
 {
     Store = SmartStore.GetGlobalSmartStore();
     SetupData();
 }