Пример #1
0
		public async Task GetDevicesAsyncTest()
		{
			var appSettings = new StubIAppSettings().ServerUrl_Get(() => "http://*****:*****@test.com", "testtest"); // login does not have access to devices

			var results = await server.GetDevicesAsync();
			Assert.IsNull(results); // we dont have access to devices this should be null

			await server.LoginAsync("*****@*****.**", "testtest"); // login does have access to devices
			results = await server.GetDevicesAsync();
			Assert.IsNotNull(results);
			Assert.IsTrue(results.Count > 0);
		}
Пример #2
0
		public async Task LoginAsyncTest()
		{
			var appSettings = new StubIAppSettings().ServerUrl_Get(() => "InvalidUrl");
			IServerSource server = new ServerDataContext(appSettings);
			var result = await server.LoginAsync("", "");
			Assert.AreEqual(LoginStatus.InvalidServerUrl, result);

			appSettings.ServerUrl_Get(() => "http://*****:*****@test.com", "test");
			Assert.AreEqual(LoginStatus.ErrorAuthenticating, result);

			result = await server.LoginAsync("*****@*****.**", "testtest");
			Assert.AreEqual(LoginStatus.Success, result);
			Assert.IsTrue(server.IsAuthenticated);
		}