コード例 #1
0
        public InformationService(TaskUnitOfWork uow)
        {
            this.uow = uow;
            var config = new MapperConfiguration(cfg =>
            {
                cfg
                .CreateMap <TaskInfo, InformationDto>()
                .ReverseMap();
            });

            mapper = config.CreateMapper();
        }
コード例 #2
0
        public void AddElemenToList()
        {
            IMapper mapper = GetMapper();

            var            taskContext    = GetTaskContextInMemory();
            TaskRepository taskRepository = new TaskRepository(taskContext, mapper, new DateTimeTools.DateTimePT());
            TaskUnitOfWork taskUnitOfWork = new TaskUnitOfWork(taskContext, taskRepository, null, null);

            taskUnitOfWork.TaskRepository.Add(new Domain.Element("pawelxxx", "Details", CoreObjects.ElementType.Task, 1));
            taskUnitOfWork.Commit();

            var element = taskContext.Element.Single();
            //var x = taskUnitOfWork.TaskRepository.GetStructure(1);
        }
コード例 #3
0
        public void AddElementForExistingTomatoTest()
        {
            IMapper mapper = GetMapper();

            var taskContext = GetTaskContextInMemory();

            taskContext.Tomato.Add(new Tomato()
            {
                Status = CoreObjects.Tomato.Status.New
            });
            taskContext.SaveChanges();

            // var taskContext = GetTaskContextInMemory();
            TomatoRepository tomatoRepository = new TomatoRepository(taskContext, mapper);
            TaskRepository   taskRepository   = new TaskRepository(taskContext, mapper, new DateTimeTools.DateTimePT());
            TaskUnitOfWork   taskUnitOfWork   = new TaskUnitOfWork(taskContext, taskRepository, tomatoRepository, null);

            Domain.Tomato currentTomato = taskUnitOfWork.TomatoRepository.GetCurrent();
            var           element       = new Domain.Element("pawel", "Details", CoreObjects.ElementType.Task, 1);

            element.Tomatoes.Add(currentTomato);
            taskUnitOfWork.TaskRepository.Add(element);
            taskUnitOfWork.Commit();
        }