public async Task GetInvoiceByStateIdShouldReturnOKIfInvoicesInDb() { // Arrange var stateId = 55; var invoice = new Invoice() { Id = 1, LandlordRent = 1000, HousingRent = 350, ColdWaterPrice = 10, HotWaterPrice = 30, GasPrice = 3, EnergyPrice = 1, HeatPrice = 70, GasSubscription = 12, EnergySubscription = 7, HeatSubscription = 10, ColdWaterConsumption = 10, HotWaterConsumption = 0, GasConsumption = 1, EnergyConsumption = 10, HeatConsumption = 0, ColdWaterState = 110, HotWaterState = 0, GasState = 110, EnergyState = 110, HeatState = 0, LandlordRentVAT = 0, HousingRentVAT = 23, WaterVAT = 23, GasVAT = 23, EnergyVAT = 23, StateId = stateId }; mockRepo.Setup(x => x.Invoice).Returns(_invoiceRepoMock.Object); _invoiceRepoMock.Setup(x => x.GetInvoiceByStateId(stateId)).ReturnsAsync(invoice); // Act var result = await _sut.GetInvoiceByStateId(stateId); // Assert Assert.IsType <OkObjectResult>(result); Assert.IsNotType <NotFoundResult>(result); }