public async Task GetAddressWithPropertyShouldReturnOkIfFoundInDatabase() { // Arrange var addressId = 1; var address = new Address() { Id = addressId, Country = "Polska", City = "Sopot", Street = "Ciasna", BuildingNumber = "1", FlatNumber = "69", PostalCode = "80-765", Property = new Property() { Id = 1, FlatLabel = "Apartament1", RoomCount = 3, FlatSize = 36, HasGas = false, HasHW = true, HasHeat = false, DisplayOnWeb = false } }; mockRepo.Setup(x => x.Address).Returns(_addressRepoMock.Object); _addressRepoMock.Setup(x => x.GetAddressWithProperty(addressId)).ReturnsAsync(address); // Act var result = await _sut.GetAddressWithProperty(addressId); // Assert Assert.IsType <OkObjectResult>(result); Assert.IsNotType <NotFoundResult>(result); }