Esempio n. 1
0
        public async Task GetArmingWaitTimeAsync_Returns_IntegerAsync()
        {
            // Arrange
            var miioDevice = new Mock <IMiioTransport>();

            miioDevice.Setup(x => x.SendMessageAsync(It.IsAny <string>())).Returns(Task.FromResult("{\"result\":[30],\"id\":1}"));
            var miioGateway = new MiioGateway(miioDevice.Object);

            // Act
            var armingWaitTime = await miioGateway.GetArmingWaitTimeAsync();

            // Assert
            miioDevice.Verify(x => x.SendMessageAsync("{\"id\": 1, \"method\": \"get_arm_wait_time\", \"params\": []}"), Times.Once());
            Assert.Equal(30, armingWaitTime);
        }