コード例 #1
0
        public async Task GetInvoiceByInvoiceIdShouldReturnOKIfInvoicesInDb()
        {
            // Arrange

            var invoiceId = 1;

            var invoice = new Invoice()
            {
                Id                   = invoiceId,
                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
            };

            mockRepo.Setup(x => x.Invoice).Returns(_invoiceRepoMock.Object);
            _invoiceRepoMock.Setup(x => x.GetInvoiceById(invoiceId)).ReturnsAsync(invoice);


            // Act
            var result = await _sut.GetInvoiceByInvoiceId(invoiceId);

            // Assert
            Assert.IsType <OkObjectResult>(result);
            Assert.IsNotType <NotFoundResult>(result);
        }