Beispiel #1
0
        public async Task Can_get_all_ManagementStaff_in_database()
        {
            using (var context = new ProcurementDbContext(ContextOptions))
            {
                ManagementStaffsController managementStaffsController = new ManagementStaffsController(context);

                var result = await managementStaffsController.GetManagementStaff();

                var viewResult = Assert.IsType <ActionResult <IEnumerable <ManagementStaff> > >(result);
                var model      = Assert.IsType <List <ManagementStaff> >(viewResult.Value);

                Assert.Equal(3, model.Count);
            }
        }
Beispiel #2
0
        public async Task Should_not_return_ManagementStaff_when_unavailable()
        {
            const string MANAGEMENT_STAFF_ID = "EMP100";

            using (var context = new ProcurementDbContext(ContextOptions))
            {
                ManagementStaffsController managementStaffsController = new ManagementStaffsController(context);

                var result = await managementStaffsController.GetManagementStaff(MANAGEMENT_STAFF_ID);

                var viewResult = Assert.IsType <ActionResult <ManagementStaff> >(result);
                Assert.IsNotType <ManagementStaff>(viewResult.Value);
                var response = Assert.IsType <NotFoundResult>(viewResult.Result);
                Assert.Equal(404, response.StatusCode);
            }
        }
Beispiel #3
0
        public async Task Can_get_ManagementStaff_By_Id()
        {
            const string MANAGEMENT_STAFF_ID = "EMP11";

            using (var context = new ProcurementDbContext(ContextOptions))
            {
                ManagementStaffsController managementStaffsController = new ManagementStaffsController(context);

                var result = await managementStaffsController.GetManagementStaff(MANAGEMENT_STAFF_ID);

                var viewResult = Assert.IsType <ActionResult <ManagementStaff> >(result);
                var model      = Assert.IsType <ManagementStaff>(viewResult.Value);

                Assert.Equal(MANAGEMENT_STAFF_ID, model.StaffId);
            }
        }