public async Task Given_A_Request_For_An_Individual_Property_When_ThePropertyDoesNotExist_Then_ReturnNotFound() { //Arrange string unknownPropertyReference = "P009"; var handlerResponse = new Detail.Result() { PropertyReference = unknownPropertyReference }; mediatorMock.Setup(x => x.Send(It.IsAny <Detail.Query>(), default(CancellationToken))).Returns(Task.FromResult <Detail.Result>(null)); //Act var sut = new PropertyController(mediatorMock.Object); var actionResult = await sut.Detail(new Detail.Query() { PropertyReference = unknownPropertyReference }) as NotFoundResult; //Assert Assert.NotNull(actionResult); Assert.Equal(actionResult.StatusCode, (Int32)System.Net.HttpStatusCode.NotFound); }