Exemple #1
0
 public static void RegisterServices()
 {
     SDKServiceLocator.RegisterService <ISFApplicationHelper, SFApplicationHelper>();
     SDKServiceLocator.RegisterService <IAuthHelper, AuthHelper>();
     SDKServiceLocator.RegisterService <IEncryptionService, Encryptor>();
     SDKServiceLocator.RegisterService <IApplicationInformationService, ApplicationService>();
 }
 public static void ClassSetup(TestContext context)
 {
     SFApplicationHelper.RegisterServices();
     SDKServiceLocator.RegisterService <ILoggingService, Hybrid.Logging.Logger>();
     Store = SmartStore.GetGlobalSmartStore();
     SetupData();
 }
Exemple #3
0
        protected override Task InitializeConfig()
        {
            SDKServiceLocator.RegisterService <IEncryptionService, Encryptor>();
            Encryptor.init(new EncryptionSettings(new HmacSHA256KeyGenerator(HashAlgorithmNames.Sha256)));
            var config = SDKManager.InitializeConfigAsync <Config>().Result;

            return(config.SaveConfigAsync());
        }
 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 RegisterServices()
        {
            // setup logger
            SDKServiceLocator.RegisterService <ILoggingService, Logger>();

            // log registering services
            LoggingService.Log("Registering Services", LoggingLevel.Information);

            // register remaining services
            SDKServiceLocator.RegisterService <IAuthHelper, AuthHelper>();
            SDKServiceLocator.RegisterService <IEncryptionService, Encryptor>();
            SDKServiceLocator.RegisterService <IApplicationInformationService, ApplicationService>();
        }
Exemple #6
0
        protected SalesforceApplication()
        {
            SFApplicationHelper.RegisterServices();
            SDKServiceLocator.RegisterService <ILoggingService, Logger>();
            Suspending += OnSuspending;

            //do upgrade on stored config, account and pincode
            UpgradeConfigAsync().Wait();
            SDKUpgradeManager.GetInstance().UpgradeAsync().Wait();

            InitializeConfig();
            SDKManager.CreateClientManager(false);
            SDKManager.RootApplicationPage = SetRootApplicationPage();
            TokenRefresher = new DispatcherTimer {
                Interval = TimeSpan.FromMinutes(TokenRefreshInterval)
            };
            TokenRefresher.Tick += RefreshToken;
            AppHelper.Initialize();
        }
        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 void SetupTest()
 {
     SFApplicationHelper.RegisterServices();
     SDKServiceLocator.RegisterService <ILoggingService, Hybrid.Logging.Logger>();
 }
Exemple #9
0
 public static void SetupClass(TestContext context)
 {
     SFApplicationHelper.RegisterServices();
     SDKServiceLocator.RegisterService <ILoggingService, Hybrid.Logging.Logger>();
 }