Exemple #1
0
        public async Task RefreshAsync_SendValidRequest()
        {
            //Arrange
            string       commandName       = "refresh";
            IRestRequest sentRequest       = null;
            var          commandSenderMock = new Mock <ICommandSender>();

            commandSenderMock
            .Setup(x => x.ExecuteRequestAsync <CommandResponse>(It.IsAny <string>(), It.IsAny <RestRequest>()))
            .Callback((string baseUrl, IRestRequest request) => sentRequest = request)
            .Returns(Task.FromResult(new CommandResponse()));
            var observingConditions = new ObservingConditions(_deviceConfiguration, commandSenderMock.Object);

            //Act
            await observingConditions.RefreshAsync();

            //Assert
            Assert.Equal(Method.PUT, sentRequest.Method);
            AssertCommonParameters(sentRequest.Parameters, _deviceConfiguration, commandName);
        }