Exemple #1
0
        public void GetSensorDescription_SendValidRequest()
        {
            //Arrange
            string commandName             = "sensordescription";
            string sensorNameParameterName = "SensorName";
            ObservingConditionSensorName sensorNameParameterValue = ObservingConditionSensorName.WindSpeed;
            IRestRequest sentRequest       = null;
            var          commandSenderMock = new Mock <ICommandSender>();

            commandSenderMock
            .Setup(x => x.ExecuteRequest <StringResponse>(It.IsAny <string>(), It.IsAny <RestRequest>()))
            .Callback((string baseUrl, IRestRequest request) => sentRequest = request)
            .Returns(new StringResponse("test"));
            var observingConditions = new ObservingConditions(_deviceConfiguration, commandSenderMock.Object);

            //Act
            observingConditions.GetSensorDescription(sensorNameParameterValue);

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