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

            miioDevice.Setup(x => x.SendMessageAsync(It.Is <string>(s => s.Contains("play_fm"))))
            .Returns(Task.FromResult("{\"result\":[\"ok\"],\"id\":1}"));

            // Act
            await miioGateway.StopRadioAsync();

            // Assert
            var msg = "{\"id\": 1, \"method\": \"play_fm\", \"params\": [\"off\"]}";

            miioDevice.Verify(x => x.SendMessageAsync(msg), Times.Once());
        }