Пример #1
0
 public ListModel(IGuidGenerator guidGenerator, DepartmentAppService departmentAppService, WorkShiftsAppService workShiftsAppService, IJsonSerializer jsonSerializer)
 {
     this.guidGenerator   = guidGenerator;
     DepartmentAppService = departmentAppService;
     WorkShiftsAppService = workShiftsAppService;
     JsonSerializer       = jsonSerializer;
 }
Пример #2
0
 public CreateModel(IRepository <DictionaryValue, Guid> dictionaryValuesRepo, EmployeeAppService employeeAppService, IRepository <PhysicalID, int> physicalIdsRepo, DepartmentAppService departmentAppService, PositionAppService positionAppService, WorkshiftAppService workShiftsAppService)
 {
     DictionaryValuesRepo      = dictionaryValuesRepo;
     this.employeeAppService   = employeeAppService;
     PhysicalIdsRepo           = physicalIdsRepo;
     this.departmentAppService = departmentAppService;
     this.positionAppService   = positionAppService;
     this.workShiftsAppService = workShiftsAppService;
 }
Пример #3
0
        public async Task TestSearchByKeywordAsync()
        {
            var(connection, options) = OpenDb();

            try
            {
                var dep1 = new Department
                {
                    Id     = Guid.NewGuid(),
                    Number = "1",
                    Name   = "sclq"
                };
                var dep2 = new Department
                {
                    Id       = Guid.NewGuid(),
                    ParentId = dep1.Id,
                    Number   = "2",
                    Name     = "sclqgs"
                };
                var dep3 = new Department
                {
                    Id       = Guid.NewGuid(),
                    ParentId = dep1.Id,
                    Number   = "3",
                    Name     = "sclqjt"
                };

                using (var db = new ServiceDbContext(options))
                {
                    await db.Departments.AddRangeAsync(dep1, dep2, dep3);

                    await db.SaveChangesAsync();
                }


                var target = new DepartmentAppService(statelessServiceContext, options, CreateMapper());

                var result = await target.SearchByKeywordAsync("sclq");

                result.Count.Should().Be(3);

                result = await target.SearchByKeywordAsync("gs");

                result.Count.Should().Be(1);
            }
            finally
            {
                connection.Close();
            }
        }