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);
 }
 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 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)});
 }
        private static void SetupData()
        {
            Store.ResetDatabase();

            Store.RegisterSoup(EMPLOYEES_SOUP, new[]
            {
                // should be TABLE_1
                new IndexSpec(FIRST_NAME, SmartStoreType.SmartString),  // should be TABLE_1_0
                new IndexSpec(LAST_NAME, SmartStoreType.SmartString),   // should be TABLE_1_1
                new IndexSpec(DEPT_CODE, SmartStoreType.SmartString),   // should be TABLE_1_2
                new IndexSpec(EMPLOYEE_ID, SmartStoreType.SmartString), // should be TABLE_1_3
                new IndexSpec(MANAGER_ID, SmartStoreType.SmartString),  // should be TABLE_1_4
                new IndexSpec(SALARY, SmartStoreType.SmartInteger)
            });                                                         // should be TABLE_1_5
            Store.RegisterSoup(DEPARTMENTS_SOUP, new[]
            {
                // should be TABLE_2
                new IndexSpec(DEPT_CODE, SmartStoreType.SmartString), // should be TABLE_2_0
                new IndexSpec(NAME, SmartStoreType.SmartString),      // should be TABLE_2_1
                new IndexSpec(BUDGET, SmartStoreType.SmartInteger)
            });                                                       // should be TABLE_2_2
            LoadData();
        }
        public static async Task TestSetup(TestContext context)
        {
            SFApplicationHelper.RegisterServices();
            SDKServiceLocator.RegisterService <ILoggingService, Hybrid.Logging.Logger>();
            var settings = new EncryptionSettings(new HmacSHA256KeyGenerator(HashAlgorithmNames.Sha256));

            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.RefreshAuthTokenAsync(account);

            _smartStore = SmartStore.GetSmartStore();
            _smartStore.ResetDatabase();
            _syncManager = SyncManager.GetInstance();
            _restClient  = new RestClient(account.InstanceUrl, account.AccessToken,
                                          async(cancellationToken) =>
            {
                account = AccountManager.GetAccount();
                account = await OAuth2.RefreshAuthTokenAsync(account);
                return(account.AccessToken);
            }
                                          );
            CreateAccountsSoup();
            _idToNames = await CreateTestAccountsOnServer(CountTestAccounts);
        }
        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);
        }
Example #7
0
 public static void TestSetup(TestContext context)
 {
     Store = SmartStore.GetGlobalSmartStore();
     Store.ResetDatabase();
     Store.RegisterSoup(TEST_SOUP, new[] { new IndexSpec("key", SmartStoreType.SmartString) });
 }
 public static void TestSetup(TestContext context)
 {
     Store = SmartStore.GetGlobalSmartStore();
     Store.ResetDatabase();
     Store.RegisterSoup(TEST_SOUP, new[] {new IndexSpec("key", SmartStoreType.SmartString)});
 }