コード例 #1
0
ファイル: TaskServiceTest.cs プロジェクト: dmozhnov/EmpireERP
        public void Init()
        {
            IoCInitializer.Init();

            var taskRepository = IoCContainer.Resolve <ITaskRepository>();
            var taskExecutionItemRepository = IoCContainer.Resolve <ITaskExecutionItemRepository>();

            taskService = new TaskService(taskRepository, taskExecutionItemRepository);

            topic           = "123";
            deal            = new Mock <Deal>();
            contractor      = new Mock <Contractor>();
            productionOrder = new Mock <ProductionOrder>();
            taskType        = new TaskType("Type_1");
            state           = new TaskExecutionState("State_1", TaskExecutionStateType.New, 1);
            taskType.AddState(state);
            taskPriority = new TaskPriority("Priority_1", 1);
            currentDate  = DateTime.Now;

            user = new User(new Employee("Иван", "Иванов", "Иванович", new EmployeePost("Менеджер"), null), "Иванов Иван", "ivanov", "pa$$w0rd", new Team("Тестовая команда", null), null);
            var role = new Role("Администратор");

            role.AddPermissionDistribution(new PermissionDistribution(Permission.Task_Create, PermissionDistributionType.All));
            user.AddRole(role);
        }
コード例 #2
0
ファイル: TaskTest.cs プロジェクト: dmozhnov/EmpireERP
        public void Init()
        {
            topic  = "123";
            topic2 = "456";

            description = "qwerty";

            completionPercentage  = 0;
            completionPercentage2 = 42;

            deal = new Mock <Deal>();
            deal.Setup(x => x.Id).Returns(711);

            contractor = new Mock <Contractor>();
            contractor.Setup(x => x.Id).Returns(71);

            productionOrder = new Mock <ProductionOrder>();
            productionOrder.Setup(x => x.Id).Returns(productionOrderId);

            taskType  = new TaskType("Type_1");
            taskType2 = new TaskType("Type_2");
            var taskExecutionState = new Mock <TaskExecutionState>();

            taskExecutionState.Setup(x => x.Id).Returns(1);
            taskExecutionState.Setup(x => x.ExecutionStateType).Returns(TaskExecutionStateType.New);
            taskExecutionState.Setup(x => x.Equals(It.Is <TaskExecutionState>(y => y.Id == 1))).Returns(true);

            var taskExecutionState2 = new Mock <TaskExecutionState>();

            taskExecutionState2.Setup(x => x.Id).Returns(2);
            taskExecutionState2.Setup(x => x.ExecutionStateType).Returns(TaskExecutionStateType.Executing);
            taskExecutionState2.Setup(x => x.Equals(It.Is <TaskExecutionState>(y => y.Id == 2))).Returns(true);
            var taskExecutionState3 = new Mock <TaskExecutionState>();

            taskExecutionState3.Setup(x => x.Id).Returns(3);
            taskExecutionState3.Setup(x => x.ExecutionStateType).Returns(TaskExecutionStateType.Completed);
            taskExecutionState3.Setup(x => x.Equals(It.Is <TaskExecutionState>(y => y.Id == 3))).Returns(true);

            var taskExecutionState4 = new Mock <TaskExecutionState>();

            taskExecutionState4.Setup(x => x.Id).Returns(4);
            taskExecutionState4.Setup(x => x.ExecutionStateType).Returns(TaskExecutionStateType.New);
            taskExecutionState4.Setup(x => x.Equals(It.Is <TaskExecutionState>(y => y.Id == 4))).Returns(true);
            taskExecutionState4.Setup(x => x.Name).Returns("State_4");

            state1 = taskExecutionState.Object;
            state2 = taskExecutionState2.Object;
            state3 = taskExecutionState3.Object;
            state4 = taskExecutionState4.Object;

            taskType.AddState(state1);
            taskType.AddState(state2);
            taskType.AddState(state3);
            taskType2.AddState(state4);

            taskPriority  = new TaskPriority("Priority_1", 1);
            taskPriority2 = new TaskPriority("Priority_2", 2);

            currentDate = DateTime.Now;

            user = new Mock <User>();
            user.Setup(x => x.Id).Returns(1);
        }