Beispiel #1
0
        public void StaffManagementController_GetWeeklyHours()
        {
            var mockRepo = new Mock <IRepository>();

            mockRepo.Setup(repo => repo.GetHoursWeekly()).Returns(5);
            var controller = new StaffManagementController(mockRepo.Object);

            var result = controller.GetWeeklyHours() as JsonResult;


            Assert.NotNull(result.Value);
        }
Beispiel #2
0
        public void StaffManagementController_GetTaskRemainigTime()
        {
            var mockRepo = new Mock <IRepository>();


            mockRepo.Setup(repo => repo.TaskRemainTime(1)).Returns(4);
            var controller = new StaffManagementController(mockRepo.Object);

            var result = controller.GetTaskRemainigTime(1) as JsonResult;

            Assert.NotNull(result.Value);
        }
Beispiel #3
0
        public void StaffManagementController_UpdateTask()
        {
            var mockRepo = new Mock <IRepository>();

            mockRepo.Setup(repo => repo.UpdateTask(1)).Returns("Updated");
            var controller = new StaffManagementController(mockRepo.Object);

            var result = controller.UpdateTask(1) as OkResult;


            Assert.AreEqual(result.StatusCode, 200);
        }
Beispiel #4
0
        public void StaffManagementController_CraeteTask()
        {
            var mockRepo = new Mock <IRepository>();
            var detail   = new TaskDetails {
                Name = "Task1", DateCreated = DateTime.Now, Hour = 6, Iscompleted = false
            };

            mockRepo.Setup(repo => repo.CreateTask(detail)).Returns("Added");
            var controller = new StaffManagementController(mockRepo.Object);

            var result = controller.CreateTask(detail) as OkResult;

            Assert.AreEqual(result.StatusCode, 200);
        }
Beispiel #5
0
        public void StaffManagementController_AssignTask()
        {
            var mockRepo = new Mock <IRepository>();
            var detail   = new AssignedtaskViewModel {
                TaskID = 1, StaffID = 1, AsiggnedHours = 4, AssignedDate = DateTime.Now
            };

            mockRepo.Setup(repo => repo.AssignedTask(detail)).Returns("Added");
            var controller = new StaffManagementController(mockRepo.Object);

            var result = controller.AssignTask(detail) as OkResult;


            Assert.AreEqual(result.StatusCode, 200);
        }
Beispiel #6
0
        public void StaffManagementController_CraeteStaff()
        {
            var mockRepo = new Mock <IRepository>();
            var detail   = new StaffDetail {
                Name = "Shivam", HoursAvailable = 8, DateCreated = DateTime.Now, IsAvailable = true
            };

            mockRepo.Setup(repo => repo.CraeteStaff(detail)).Returns("Added");
            var controller = new StaffManagementController(mockRepo.Object);

            var result1 = controller.CreateStaff(detail);
            var result  = result1 as OkResult;

            Assert.AreEqual(result.StatusCode, 200);
        }
Beispiel #7
0
        public void StaffManagementController_GetWeeklyTasks()
        {
            var mockRepo = new Mock <IRepository>();
            var detail   = new TaskDetails {
                Name = "Task1", DateCreated = DateTime.Now, Hour = 6, Iscompleted = false
            };

            mockRepo.Setup(repo => repo.GetTasksWeekely()).Returns(new List <TaskDetails> {
                detail
            });
            var controller = new StaffManagementController(mockRepo.Object);

            var result = controller.GetWeeklyTasks() as JsonResult;


            Assert.NotNull(result.Value);
        }
Beispiel #8
0
        public void StaffManagementController_GetActiveStaffList()
        {
            var mockRepo = new Mock <IRepository>();
            var detail   = new StaffDetail {
                Name = "Shivam", DateCreated = DateTime.Now, HoursAvailable = 8, IsAvailable = true
            };

            mockRepo.Setup(repo => repo.GetActiveStaff()).Returns(new List <StaffDetail> {
                detail
            });
            var controller = new StaffManagementController(mockRepo.Object);

            var result = controller.GetActiveStaffList() as JsonResult;


            Assert.NotNull(result.Value);
        }
Beispiel #9
0
 public void Initialize()
 {
     _controller = new StaffManagementController(new StaffManagementRepository(ConfigurationManager.AppSettings["UnitTestToken"]));
 }