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

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

            // Act
            var armingVolume = await miioGateway.GetArmingVolumeAsync();

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