예제 #1
0
        public void TaskZoneAssigningWorks()
        {
            User user = userRepositoriy.CreateUser(new User()
            {
                FirstName = "test_name", FamilyName = "test_family", MiddleName = "test_middlename", Level = UserLevel.Scaner, CreatedAt = DateTime.UtcNow, Login = "******", Password = "******"
            });
            User manager = userRepositoriy.CreateUser(new User()
            {
                FirstName = "test_manager_name", FamilyName = "test_manager_family", MiddleName = "test_manager_middlename", Level = UserLevel.Scaner, CreatedAt = DateTime.UtcNow, Login = "******", Password = "******"
            });

            Company company = companyRepositoriy.CreateCompany("Тест1");

            Business.Model.Inventorization inventarisation = inventorizationRepositoriy.CreateInventorization(company.Id, DateTime.UtcNow);
            Guid      firstZoneId = Guid.NewGuid();
            ZoneModel firstZone   = new ZoneModel()
            {
                Id   = firstZoneId,
                Name = "тестовая зона 1"
            };

            zoneRepository.Create(firstZone);
            Guid firstTaskId = Guid.NewGuid();

            taskRepository.CreateTask(firstTaskId, manager.Id, user.Id, inventarisation.Id);

            Business.Model.Task task = taskRepository.GetTask(firstTaskId);
            Assert.AreEqual(0, task.ZoneIds.Length);

            taskRepository.AddZone(firstTaskId, firstZoneId);

            task = taskRepository.GetTask(firstTaskId);

            Assert.IsNotNull(task);
            Assert.AreEqual(1, task.ZoneIds.Count());

            taskRepository.DeleteTask(firstTaskId);
            zoneRepository.DeleteZone(firstZoneId);
            inventorizationRepositoriy.DeleteInventorization(inventarisation.Id);
            companyRepositoriy.DeleteCompany(company.Id);
        }