示例#1
0
        public void IsArmingOn_Returns_Arming_State()
        {
            // Arrange
            var miioDevice = new Mock <IMiioTransport>();

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

            // Act
            var arming = miioGateway.IsArmingOn();

            // Assert
            miioDevice.Verify(x => x.SendMessage("{\"id\": 1, \"method\": \"get_arming\", \"params\": []}"), Times.Once());
            Assert.True(arming);
        }