public async Task IsAbsoluteAsync_SendValidRequest() { //Arrange string commandName = "absolute"; IRestRequest sentRequest = null; var commandSenderMock = new Mock <ICommandSender>(); commandSenderMock .Setup(x => x.ExecuteRequestAsync <BoolResponse>(It.IsAny <string>(), It.IsAny <RestRequest>())) .Callback((string baseUrl, IRestRequest request) => sentRequest = request) .Returns(Task.FromResult(new BoolResponse(false))); var focuser = new Focuser(_deviceConfiguration, commandSenderMock.Object); //Act await focuser.IsAbsoluteAsync(); //Assert Assert.Equal(Method.GET, sentRequest.Method); AssertCommonParameters(sentRequest.Parameters, _deviceConfiguration, commandName); }