Esempio n. 1
0
        public async Task GetPressureAsync_SendValidRequest()
        {
            //Arrange
            string       commandName       = "pressure";
            IRestRequest sentRequest       = null;
            var          commandSenderMock = new Mock <ICommandSender>();

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

            //Act
            await observingConditions.GetPressureAsync();

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