Beispiel #1
0
        public void CreateEmployee_ActionExecutes_ReturnsOk()
        {
            var result = _controller.CreateEmployee(new User
            {
                Id               = "37846734-172e-4149-8cec-6f43d1eb3f60",
                UserName         = "******",
                IsEmailConfirmed = true,
                Email            = "*****@*****.**",
                Password         = "******",
                Role             = UserRoles.Employee,
                Contact          = new Contact()
            });;

            Assert.IsType <OkResult>(result);
        }
Beispiel #2
0
        public void CreateEmployee_ValidTest()
        {
            Initialize();
            var controller = new EmployeeController(mockEmpRepo.Object, mockLogger.Object);

            // Act
            var result = controller.CreateEmployee();

            // Assert
            var viewResult = Assert.IsType <ViewResult>(result);;
        }
Beispiel #3
0
        public void TestCreateEmployee(string firstName)
        {
            _controller.CreateEmployee(new Employee {
                FirstName = firstName
            });

            var employees = Repo.Query.ToList()
                            .OrderBy(e => e.Id);

            Assert.Collection(employees,
                              new Action <Employee>[] {
                item => Assert.Contains("Bob", item.FirstName),
                item => Assert.Contains("Monty", item.FirstName),
                item => Assert.Contains("Drew", item.FirstName),
                item => Assert.Contains("Wayne", item.FirstName),
                item => Assert.Contains(firstName, item.FirstName),
            });
        }
Beispiel #4
0
        public async Task NormalEmployee()
        {
            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);

            // simulate payment
            await _paymentController.SimulateReceivePayment(new ReceivePaymentRequest()
            {
                InvoiceId = invoiceId
            });

            payment = await _paymentController.GetPayment(invoiceId);

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

            var payout = await _payoutController.GetPayout(invoiceId);

            Assert.Equal(5060m, Math.Floor(payout.Amount));

            assignment = await _assignmentController.GetAssignment(invoiceId);

            Assert.Equal(Status.Closed, assignment.CurrentStatus);
        }
Beispiel #5
0
 private void btnNewEmployee_Click(object sender, EventArgs e)
 {
     controller.CreateEmployee();
 }