예제 #1
0
        public async void Invoice_GetInvoiceById_Return_NotFoundResult()
        {
            //Arrange
            var controller = new InvoiceController(_context);
            var invoiceId  = 500;

            //Act
            var data = await controller.GetInvoice(invoiceId);

            //Assert
            Assert.IsType <NotFoundResult>(data);
        }
예제 #2
0
        public void GetInvoiceTest()
        {
            var     id        = Guid.Parse("75A3489C-6321-4D5C-9061-1AABA0FC8BBA");
            Invoice invoiceDB = _context.Invoice.Find(id);

            Assert.IsNotNull(invoiceDB, "Null. Inovice is not in database.");

            Invoice invoice = _InvoiceController.GetInvoice(id).Value;

            Assert.IsNotNull(invoice, "Null. Inovice is not in database.");

            Assert.AreEqual(invoiceDB.Id, invoice.Id, "InvoiceDB.Id != Invoice.Id");
        }
        public void GetInvoice(bool isValidBan, bool isValidInvoiceNumber)
        {
            //// Arrange
            var ban           = GetBanStr(isValidBan);
            var invoiceNumber = GetInvoiceNumber(isValidInvoiceNumber);

            // // invoiceService.GetInvoice(User.UserId(), ban, invoiceNumber)

            //// Act
            var result = _controller.GetInvoice(ban, invoiceNumber);

            //// Assert
            Assert.IsNotNull(result);
        }
예제 #4
0
        public async void Invoice_GetInvoiceById_MatchResult()
        {
            //Arrange
            var controller = new InvoiceController(_context);
            int?invoiceId  = 1;

            //Act
            var data = await controller.GetInvoice(invoiceId.Value);

            //Assert
            Assert.IsType <OkObjectResult>(data);

            var okResult = data.Should().BeOfType <OkObjectResult>().Subject;
            var invoice  = okResult.Value.Should().BeAssignableTo <Invoice>().Subject;

            Assert.Equal(1, invoice.InvoiceId);
            Assert.Equal(1, invoice.CustomerId);
        }
예제 #5
0
        private void LoadData()
        {
            txtOrderNo.Text = this.orderNo;
            if (String.IsNullOrEmpty(this.invoiceNo))
            {
                Order order = OrderController.GetOrder(this.orderNo);
                if (order != null)
                {
                    txtInvoiceNo.Text         = "";
                    dtpInvoiceDate.Value      = order.RequestDate;
                    cboCustomer.SelectedValue = order.Customer.CustomerCode;
                    //customerCode = order.Customer.CustomerCode;
                    txtComment.Text         = "";
                    chkActive.Checked       = order.Active;
                    cboTrucko.SelectedValue = TruckController.GetTruckNoFromTransport(this.orderNo);

                    //dtpInvoiceDate.Enabled = true;
                }
                BtnCancel.Visible = false;
            }
            else
            {
                Invoice invoice = InvoiceController.GetInvoice(this.invoiceNo);
                if (invoice != null)
                {
                    txtInvoiceNo.Text         = invoice.InvoiceNo;
                    dtpInvoiceDate.Value      = invoice.InvoiceDate;
                    txtOrderNo.Text           = invoice.RefDocumentNo;
                    txtReceiptNo.Text         = invoice.ReceiptNo;
                    lbPrintNo.Text            = invoice.PrintNo.ToString();
                    cboCustomer.SelectedValue = invoice.Customer.CustomerCode;
                    cboTrucko.SelectedValue   = invoice.Truck.TruckId;
                    txtComment.Text           = invoice.Comments;
                    chkActive.Checked         = invoice.Active;
                    txtGrossAmt.Text          = invoice.GrossAmt.ToString();
                    txtDiscount.Text          = invoice.DiscAmtBill.ToString();
                    txtBeforeVat.Text         = (invoice.GrossAmt - invoice.DiscAmtBill).ToString();
                    txtVatAmt.Text            = invoice.VatAmt.ToString();
                    txtNetAmt.Text            = invoice.NetAmt.ToString();
                    if (invoice.VatRate > 0)
                    {
                        chkVatFlag.Checked = true;
                        txtVatRate.Text    = invoice.VatRate.ToString();
                    }
                    else
                    {
                        chkVatFlag.Checked = false;
                        txtVatRate.Text    = "";
                    }

                    chkActive.Enabled   = false;
                    BtnSave.Enabled     = false;
                    txtDiscount.Enabled = false;
                    chkVatFlag.Enabled  = false;
                    txtVatRate.Enabled  = false;
                    cboTrucko.Enabled   = false;
                    if (chkActive.Checked == false)
                    {
                        BtnCancel.Visible  = false;
                        txtComment.Enabled = false;
                    }
                }
            }
            SetFormatNumberTextbox();
            LoadDetail();
        }
예제 #6
0
파일: UnitTest1.cs 프로젝트: cykelbud/lrms
        public async Task PaymentDue()
        {
            var request = new CreateEmployeeRequest()
            {
                PersonalIdentificationNumber = "1234567890",
                UserName = "******",
            };
            var employeeId = await _employeeController.CreateEmployee(request);

            var customerRequest = new CreateCustomerRequest()
            {
                EmployeeId = employeeId,
                PersonalIdentificationNumber = "customer ssn",
                UserName = "******",
                Address  = "address"
            };
            var customerId = await _customerController.CreateCustomer(customerRequest);

            var createInvoiceRequest = new CreateInvoiceRequest()
            {
                EmployeeId   = employeeId,
                CustomerId   = customerId,
                PayInAdvance = false,
                InvoiceItems = new List <InvoiceItemDto>()
                {
                    new InvoiceItemDto()
                    {
                        Price = 10000.0m, Description = "städning"
                    }
                }.ToArray(),
                EndDate            = DateTime.Now,
                StartDate          = DateTime.Now,
                Name               = "invoiceName",
                Vat                = 25m,
                InvoiceDescription = "invoice description"
            };
            var invoiceId = await _invoiceController.CreateInvoice(createInvoiceRequest);

            var assignment = await _assignmentController.GetAssignment(invoiceId);

            Assert.Equal(Status.Created, assignment.CurrentStatus);

            await _invoiceController.SendInvoice(invoiceId);

            var payment = await _paymentController.GetPayment(invoiceId);

            Assert.Equal(PaymentState.WaitingForPayment, payment.CurrentState);

            await _paymentController.SimulatePaymentDue(new PaymentDueRequest()
            {
                InvoiceId = invoiceId
            });

            var invoice = await _invoiceController.GetInvoice(invoiceId);

            Assert.NotNull(invoice.ReminderSentDate);

            await _paymentController.SimulatePaymentDebtCollection(invoiceId);

            await _paymentController.SimulatePaymentPaymentInjuction(invoiceId);

            await _paymentController.SimulatePaymentDistraint(invoiceId);

            var payout = await _payoutController.GetPayout(invoiceId);

            Assert.Null(payout);

            assignment = await _assignmentController.GetAssignment(invoiceId);

            Assert.Equal(Status.WaitingForPaymentFromCustomer, assignment.CurrentStatus);
        }