public static async Task TestSetup(TestContext context)
 {
     SFApplicationHelper.RegisterServices();
     SDKServiceLocator.RegisterService<ILoggingService, Hybrid.Logging.Logger>();
     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.RefreshAuthTokenAsync(account);
     _smartStore = SmartStore.GetSmartStore();
     _smartStore.ResetDatabase();
     _syncManager = SyncManager.GetInstance();
     _restClient = new RestClient(account.InstanceUrl, account.AccessToken,
         async () =>
         {
             account = AccountManager.GetAccount();
             account = await OAuth2.RefreshAuthTokenAsync(account);
             return account.AccessToken;
         }
         );
     CreateAccountsSoup();
     _idToNames = await CreateTestAccountsOnServer(CountTestAccounts);
 }
Exemplo n.º 2
0
        public static void RavenStorageTestsInit(TestContext context)
        {
            Dsn dsn = new Dsn(RavenConfig.DSN);
            RavenClient.InitializeAsync(dsn);

            _storageClient = new RavenStorageClient();
        }
 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)});
 }
Exemplo n.º 5
0
 public static void Setup(TestContext ctxt)
 {
     testedInts = new int[] { 244, 122, 5565, 2, 3 };
     bufferInt = new List<byte>()
         .Concat(BitConverter.GetBytes(0x1cb5c415))
         .Concat(BitConverter.GetBytes(new TLInt(testedInts.Length).Value))
         .Concat(testedInts.Select(i => BitConverter.GetBytes(i)).SelectMany(a => a))
         .ToArray();
 }
 public static void Initialize(TestContext context)
 {
     var testHandler = TestMessageHandler.FromResourceResponse("RouteFrom1172_34ToRedlandsCA");
     var task = new RouteService(testHandler).GetRoute(
         new MapPoint(-117.2, 34) { SpatialReference = SpatialReferences.Wgs84 },
         new MapPoint(-117.18253721699972, 34.055566969000438) { SpatialReference = SpatialReferences.Wgs84 },
         CancellationToken.None);
     task.Wait();
     route = task.Result;
 }
Exemplo n.º 7
0
        public static void Initalize(TestContext context)
        {
            var httpServer = new HttpServer();
            httpServer.restHandler.RegisterController(new TestController());

            ServerTask = 
                ThreadPool.RunAsync((w) =>
                {
                    httpServer.StartServer();
                });

            Client = new HttpClient();
        }
        public static void ClassInitialize(TestContext testContext)
        {
            GpioController gpioController = GpioController.GetDefault();
            _irqPin = gpioController.InitGpioPin(25, GpioPinDriveMode.InputPullUp);
            _cePin = gpioController.InitGpioPin(22, GpioPinDriveMode.Output);

            DeviceInformationCollection devicesInfo = DeviceInformation.FindAllAsync(SpiDevice.GetDeviceSelector("SPI0")).GetAwaiter().GetResult();
            _spiDevice = SpiDevice.FromIdAsync(devicesInfo[0].Id, new SpiConnectionSettings(0)).GetAwaiter().GetResult();
            _commandProcessor = new CommandProcessor(_spiDevice); // new MockCommandProcessor();
            _loggerFactoryAdapter = new NoOpLoggerFactoryAdapter();

            _radio = new Radio(_commandProcessor, _loggerFactoryAdapter, _cePin, _irqPin);
        }
Exemplo n.º 9
0
        public static void BeforeAll(TestContext testContext) {
            _expectedMessages = new List<Message> {
                CreateDisplayableMessage(userId: 1),
                CreateDisplayableMessage(userId: 2)
            };

            _expectedUsers = new List<User> {
                new User() { Id = 1, Avatar = new Uri("http://www.example.com/1.png") },
                new User() { Id = 2, Avatar = new Uri("http://www.example.com/2.png") }
            };

            _mockFlowdockContext = new MockFlowdockContext();
            _mockFlowdockContext.ExpectedMessages = _expectedMessages;
            _mockFlowdockContext.ExpectedUsers = _expectedUsers;
        }
Exemplo n.º 10
0
        static public void AssemblyInitialize(TestContext context)
        {
            CanvasDevice.DebugLevel = CanvasDebugLevel.Warning;

            // But the debug layer might not be installed on the current machine!
            // When it's not available, attempting to create a device using it will fail.
            // We don't want to require installing the debug layer in order to run tests,
            // so we'll just turn it off again if that happens.
            try
            {
                new CanvasDevice().Dispose();
            }
            catch (COMException)
            {
                CanvasDevice.DebugLevel = CanvasDebugLevel.None;
            }
        }
        public static async Task MyClassInitialize(TestContext testContext)
        {
            tableClient = GenerateCloudTableClient();
            currentTable = tableClient.GetTableReference(GenerateRandomTableName());
            await currentTable.CreateIfNotExistsAsync();

            for (int i = 0; i < 15; i++)
            {
                TableBatchOperation batch = new TableBatchOperation();

                for (int j = 0; j < 100; j++)
                {
                    DynamicTableEntity ent = GenerateRandomEntity("tables_batch_" + i.ToString());
                    ent.RowKey = string.Format("{0:0000}", j);
                    batch.Insert(ent);
                }

                await currentTable.ExecuteBatchAsync(batch);
            }
        }
        public static async Task MyClassInitialize(TestContext testContext)
        {
            CloudTableClient tableClient = GenerateCloudTableClient();

            // 20 random tables
            for (int m = 0; m < 20; m++)
            {
                CloudTable tableRef = tableClient.GetTableReference(GenerateRandomTableName());
                await tableRef.CreateIfNotExistsAsync();
                createdTables.Add(tableRef);
            }

            prefixTablesPrefix = "prefixtable" + GenerateRandomTableName();
            // 20 tables with known prefix
            for (int m = 0; m < 20; m++)
            {
                CloudTable tableRef = tableClient.GetTableReference(prefixTablesPrefix + m.ToString());
                await tableRef.CreateIfNotExistsAsync();
                createdTables.Add(tableRef);
            }
        }
 public static void TestSetup(TestContext context)
 {
     Store = SmartStore.GetGlobalSmartStore();
     Store.ResetDatabase();
     Store.RegisterSoup(TEST_SOUP, new[] {new IndexSpec("key", SmartStoreType.SmartString)});
 }
 public static void AssemlyInitialize(TestContext testContext)
 {
     AdalTests.TestType = TestType.WinRT;
     ReplayerBase.InitializeAsync().Wait();
 }
 public static void SetupClass(TestContext context)
 {
     SFApplicationHelper.RegisterServices();
     SDKServiceLocator.RegisterService<ILoggingService, Hybrid.Logging.Logger>();
 }
Exemplo n.º 16
0
 public static void InitializeTestActivityHandlerUAP10(TestContext testContext)
 {
     TestActivityHandler = new TestActivityHandler(new UtilUAP10(), new AssertTestUAP10(), TargetPlatform.wuap);
 }
 public async static Task TestSetup(TestContext context)
 {
     Store = SmartStore.GetGlobalSmartStore();
     SetupData();
 }
 public static async Task MyClassInitialize(TestContext testContext)
 {
     client = GenerateCloudQueueClient();
     startProperties = await client.GetServicePropertiesAsync();
 }
Exemplo n.º 19
0
 public static void InitializeTestPackageHandlerWS(TestContext testContext)
 {
     TestPackageHandler = new TestPackageHandler(new UtilWS(), new AssertTestWS());
 }
 public static void Initialize(TestContext context)
 {
     _accessor = new DataContractPropertyAccessor();
 }
 public static void InitializeAllTests(TestContext context)
 {
     //ResourcesHelperInitializer
 }
Exemplo n.º 22
0
 public static void Setup(TestContext ctxt)
 {
     bufferTrue = BitConverter.GetBytes(0x997275b5);
     bufferFalse = BitConverter.GetBytes(0xbc799737);
 }
Exemplo n.º 23
0
 public static void InitializeTestAttributionHandlerWS(TestContext testContext)
 {
     TestAttributionHandler = new TestAttributionHandler(new UtilWS(), new AssertTestWS(), TargetPlatform.wstore);
 }
Exemplo n.º 24
0
 public static void InitializeTestRequestHandlerWS(TestContext testContext)
 {
     TestRequestHandler = new TestRequestHandler(new UtilWP81(), new AssertTestWP81());
 }
Exemplo n.º 25
0
        public static void Setup(TestContext context)
        {
            CS.SetDB("test.db",SqliteOption.CreateAlways,null);

            CSDatabase.ExecuteNonQuery(
                "CREATE TABLE tblCustomers (CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,Name TEXT(50) NOT NULL)");

            CSDatabase.ExecuteNonQuery(
                @"CREATE INDEX tblCustomers_Name ON tblCustomers (Name)");

            CSDatabase.ExecuteNonQuery(
                @"CREATE TABLE tblCustomerPaymentMethodLinks (
            	                CustomerID integer NOT NULL,
            	                PaymentMethodID integer NOT NULL,
                                primary key (CustomerID,PaymentMethodID)
                                )");



            CSDatabase.ExecuteNonQuery(
@"CREATE TABLE tblOrderItems (
            	OrderItemID INTEGER PRIMARY KEY AUTOINCREMENT,
            	OrderID integer NOT NULL,
            	Qty integer NOT NULL,
            	Price real NOT NULL,
            	Description TEXT(200) NOT NULL
                )
            ");

            CSDatabase.ExecuteNonQuery(
                @"CREATE INDEX tblOrderItems_OrderID ON tblOrderItems (OrderID)");

            CSDatabase.ExecuteNonQuery(
@"CREATE TABLE tblOrders (
            	OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
            	Date TEXT(30) NOT NULL DEFAULT CURRENT_TIMESTAMP,
            	CustomerID integer NOT NULL,
            	SalesPersonID integer NULL,
            	DataState text(50))");

            CSDatabase.ExecuteNonQuery(
    @"CREATE INDEX tblOrders_CustomerID ON tblOrders (CustomerID)");

            CSDatabase.ExecuteNonQuery(
@"CREATE INDEX tblOrders_SalesPersonID ON tblOrders (SalesPersonID)");

            CSDatabase.ExecuteNonQuery(
                @"CREATE TABLE tblPaymentMethods (
            	PaymentMethodID integer primary key autoincrement,
            	Name text(50) NOT NULL,
            	MonthlyCost integer NOT NULL
             )");

            CSDatabase.ExecuteNonQuery(
@"CREATE TABLE tblSalesPeople (
            	SalesPersonID integer primary key autoincrement,
            	Name text(50) NOT NULL,
            	SalesPersonType integer NULL)
             ");

            CSDatabase.ExecuteNonQuery(
@"CREATE TABLE tblCoolData (
            	CoolDataID text(50) PRIMARY KEY,
            	Name text(50) NULL)");

        }
Exemplo n.º 26
0
 public static void RavenClientTestsInit(TestContext context)
 {
     Dsn dsn = new Dsn(RavenConfig.DSN);
     RavenClient.InitializeAsync(dsn);
 }
Exemplo n.º 27
0
 public static void InitializeTestActivityHandlerWS(TestContext testContext)
 {
     TestActivityHandler = new TestActivityHandler(new UtilWP81(), new AssertTestWP81(), TargetPlatform.wphone81);
 }
Exemplo n.º 28
0
 public static void InitializeAssembly(Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestContext c)
 {
     new _SetUpFixture().SetupCurrentNamespaceTests();
     MsgPack.NUnitPortable.TestingPlatform.Current = new MSTest12TestingPlatform();
 }
		public static void SetupTests(TestContext context)
		{
			var dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher;
			ThreadHelper.Initialize(dispatcher);
		}
 public static void MyClassInitialize(TestContext testContext)
 {
     client = GenerateCloudQueueClient();
     startProperties = client.GetServicePropertiesAsync().AsTask().Result;
 }
Exemplo n.º 31
0
 public static void SetupTests(TestContext testContext)
 {
     _testContext = testContext;
     logic = new DpLogic();
 }