public void GetStepSize_SendValidRequest() { //Arrange string commandName = "stepsize"; IRestRequest sentRequest = null; var commandSenderMock = new Mock <ICommandSender>(); commandSenderMock .Setup(x => x.ExecuteRequest <DoubleResponse>(It.IsAny <string>(), It.IsAny <RestRequest>())) .Callback((string baseUrl, IRestRequest request) => sentRequest = request) .Returns(new DoubleResponse(1.0)); var focuser = new Focuser(_deviceConfiguration, commandSenderMock.Object); //Act focuser.GetStepSize(); //Assert Assert.Equal(Method.GET, sentRequest.Method); AssertCommonParameters(sentRequest.Parameters, _deviceConfiguration, commandName); }