コード例 #1
0
        public void GetSupportedActions_SendValidRequest()
        {
            //Arrange
            string       commandName       = "supportedactions";
            IRestRequest sentRequest       = null;
            var          commandSenderMock = new Mock <ICommandSender>();

            commandSenderMock
            .Setup(x => x.ExecuteRequest <StringListResponse>(It.IsAny <string>(), It.IsAny <RestRequest>()))
            .Callback((string baseUrl, IRestRequest request) => sentRequest = request)
            .Returns(new StringListResponse(new List <string> {
                "test"
            }));
            var device = new FilterWheel(_deviceConfiguration, commandSenderMock.Object);

            //Act
            device.GetSupportedActions();

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