Пример #1
0
        public void Test_mapper_complex()
        {
            /// ProcessHistoryRepository processHistoryRepository = new ProcessHistoryRepository(null, new DowntimeRepositoryMapper());
            var mapper = new DowntimeRepositoryMapper();

            var id             = Guid.NewGuid();
            var interruptionId = 23;

            var item = new ProcessHistoryModel
            {
                Id = id,
                FinishProcessDateTime = DateTime.Now,
                StartProcessDateTime  = DateTime.Now.AddMinutes(-1),
                Interruption          = new InterruptionHistoryModel
                {
                    Id            = interruptionId,
                    StartDateTime = DateTime.Now.AddSeconds(-10),
                    EndDateTime   = DateTime.Now
                },
                ProductSpecification = new ProductSpecificationModel
                {
                    Code            = "Codio1",
                    StandarDuration = 3
                }
            };
            var entity  = mapper.Map <ProcessHistory>(item);
            var newItem = mapper.Map <ProcessHistoryModel>(entity);

            Assert.AreEqual(id, newItem.Id);
            Assert.AreEqual(interruptionId, newItem.Interruption.Id);
            Assert.AreEqual(item.StartProcessDateTime, newItem.StartProcessDateTime);
            Assert.AreEqual("Codio1", newItem.ProductSpecification.Code);
            Assert.AreEqual(3, newItem.ProductSpecification.StandarDuration);
        }
Пример #2
0
 public ProcessHistoryRepository(ProcessHistoryUnitOfWork processHistoryUnitOfWork,
                                 DowntimeRepositoryMapper mapper,
                                 TableQueryFactory tableQuery)
 {
     this.processHistoryUnitOfWork = processHistoryUnitOfWork;
     this.mapper     = mapper;
     this.tableQuery = tableQuery;
 }
Пример #3
0
        public Startup(IDowntimeRepository repository, DowntimeRepositoryMapper mapper, ILogger <Startup> logger)
        {
            this.repository = repository;
            this.mapper     = mapper;
            this.logger     = logger;

            logger.LogInformation("Hola mundo info");
            logger.LogError("Hola mundo error");
            logger.LogWarning("Hola mundo warning");
        }
Пример #4
0
        public void Test_mapper_simple()
        {
            /// ProcessHistoryRepository processHistoryRepository = new ProcessHistoryRepository(null, new DowntimeRepositoryMapper());
            var mapper = new DowntimeRepositoryMapper();

            var item = new ProcessHistoryModel {
                Id = Guid.NewGuid(),
                FinishProcessDateTime = DateTime.Now,
                StartProcessDateTime  = DateTime.Now.AddMinutes(-1)
            };
            var entity  = mapper.Map <ProcessHistory>(item);
            var newItem = mapper.Map <ProcessHistoryModel>(entity);

            Assert.AreEqual(item.Id, newItem.Id);
            Assert.AreEqual(item.StartProcessDateTime, newItem.StartProcessDateTime);
        }
Пример #5
0
 public ProcessHistoryRepositoryCache(DowntimeRepositoryMapper mapper)
 {
     this.mapper = mapper;
 }