Beispiel #1
0
        public async Task TestActuator()
        {
            SessionInfo session = new SessionInfo(TestCredentials.USERNAME, TestCredentials.PASSWORD, TestCredentials.HOSTNAME);
            await session.AuthenticateAsync();

            string ain = "087610251884";

            bool?initial_state = await session.GetSwitchStateAsync(TestCredentials.LampAIN);

            switch (initial_state)
            {
            case true: Debug.WriteLine($"{ain} ist AN"); break;

            case false: Debug.WriteLine($"{ain} ist AUS"); break;

            case null: Debug.WriteLine($"{ain} ist UNBEKANNT"); break;
            }

            Assert.IsNotNull(initial_state);

            await Task.Delay(500);

            bool temp_state = await session.SetSwitchAsync(ain, initial_state == false);

            await Task.Delay(1500);

            bool restored_state = await session.ToggleSwitchAsync(ain);

            await Task.Delay(1500);

            bool?check_state = await session.GetSwitchStateAsync(ain);

            Assert.IsTrue(initial_state == check_state);
        }
Beispiel #2
0
        public async Task InvalidAIN()
        {
            SessionInfo session = new SessionInfo(TestCredentials.USERNAME, TestCredentials.PASSWORD, TestCredentials.HOSTNAME);
            await session.AuthenticateAsync();

            string ain = "012345678910";

            await Assert.ThrowsExceptionAsync <HttpRequestException>(async delegate
            {
                bool?state = await session.GetSwitchStateAsync(ain);
            });
        }