예제 #1
0
 public ClientsDataController(DutyService dutyApp, OrganizeService organizeApp, ItemsDetailService itemDetailApp, ItemsService itemsApp, RoleService roleApp, RoleAuthorizeService roleAuthorizeApp, MenuService menuApp, MenuButtonService menuButtonApp)
 {
     this.itemDetailApp    = itemDetailApp;
     this.itemsApp         = itemsApp;
     this.organizeApp      = organizeApp;
     this.roleApp          = roleApp;
     this.dutyApp          = dutyApp;
     this.roleAuthorizeApp = roleAuthorizeApp;
     this.menuApp          = menuApp;
     this.menuButtonApp    = menuButtonApp;
 }
예제 #2
0
        private object GetDutyList()
        {
            DutyService dutyService = new DutyService();
            var         data        = dutyService.GetList();
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            foreach (DutyGridDto item in data)
            {
                var fieldItem = new
                {
                    encode   = item.EnCode,
                    fullname = item.FullName
                };
                dictionary.Add(item.Id, fieldItem);
            }
            return(dictionary);
        }
예제 #3
0
        private object GetDutyList()
        {
            DutyService _dutyService = new DutyService();
            var         data         = _dutyService.GetList();
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            foreach (RoleBaseEntity item in data)
            {
                var fieldItem = new
                {
                    encode   = item.F_EnCode,
                    fullname = item.F_FullName
                };
                dictionary.Add(item.F_Id, fieldItem);
            }
            return(dictionary);
        }
        public void GetForDate_ThrowsException_When_FamilyMemberId_Is_Not_Positive_Number()
        {
            //Arrange
            var dutyRepo = new Mock <IDutyRepository>();

            dutyRepo.Setup(c => c.Get(It.IsAny <Expression <Func <Duty, bool> > >()))
            .Returns((Expression <Func <Duty, bool> > expression) =>
            {
                var data = duties.Where(expression.Compile()).AsQueryable();
                return(data);
            });

            var service = new DutyService(dutyRepo.Object);

            //Act
            var result = service.GetForDate(-2, DateTime.Now);

            //Assert.
        }
        public void GetForDate_Returns_Duties()
        {
            //Arrange

            var dateToCheck    = new DateTime(2018, 1, 13);
            int familyMemberId = 554;
            var dutyRepo       = new Mock <IDutyRepository>();

            dutyRepo.Setup(c => c.Get(It.IsAny <Expression <Func <Duty, bool> > >()))
            .Returns((Expression <Func <Duty, bool> > expression) =>
            {
                var data = duties.Where(expression.Compile()).AsQueryable();
                return(data);
            });

            var service = new DutyService(dutyRepo.Object);

            //Act
            var result = service.GetForDate(familyMemberId, dateToCheck);

            //Assert.
            Assert.AreEqual(result.Count, 1);
            Assert.AreEqual(result[0].Id, 2);
        }
 public DutyController(DutyService dutyApp)
 {
     this.dutyApp = dutyApp;
 }
예제 #7
0
 public DutiesController(DutyService dutyService)
 {
     _dutyService = dutyService;
 }