Exemple #1
0
        public virtual PipelineStepStepRequirement MapBOToEF(
            BOPipelineStepStepRequirement bo)
        {
            PipelineStepStepRequirement efPipelineStepStepRequirement = new PipelineStepStepRequirement();

            efPipelineStepStepRequirement.SetProperties(
                bo.Details,
                bo.Id,
                bo.PipelineStepId,
                bo.RequirementMet);
            return(efPipelineStepStepRequirement);
        }
Exemple #2
0
        public virtual BOPipelineStepStepRequirement MapEFToBO(
            PipelineStepStepRequirement ef)
        {
            var bo = new BOPipelineStepStepRequirement();

            bo.SetProperties(
                ef.Id,
                ef.Details,
                ef.PipelineStepId,
                ef.RequirementMet);
            return(bo);
        }
        public void MapModelToEntity()
        {
            var mapper = new DALPipelineStepStepRequirementMapper();
            ApiPipelineStepStepRequirementServerRequestModel model = new ApiPipelineStepStepRequirementServerRequestModel();

            model.SetProperties("A", 1, true);
            PipelineStepStepRequirement response = mapper.MapModelToEntity(1, model);

            response.Details.Should().Be("A");
            response.PipelineStepId.Should().Be(1);
            response.RequirementMet.Should().Be(true);
        }
Exemple #4
0
        public virtual async Task <ApiPipelineStepStepRequirementServerResponseModel> Get(int id)
        {
            PipelineStepStepRequirement record = await this.PipelineStepStepRequirementRepository.Get(id);

            if (record == null)
            {
                return(null);
            }
            else
            {
                return(this.DalPipelineStepStepRequirementMapper.MapEntityToModel(record));
            }
        }
        public void MapEntityToModelList()
        {
            var mapper = new DALPipelineStepStepRequirementMapper();
            PipelineStepStepRequirement item = new PipelineStepStepRequirement();

            item.SetProperties(1, "A", 1, true);
            List <ApiPipelineStepStepRequirementServerResponseModel> response = mapper.MapEntityToModel(new List <PipelineStepStepRequirement>()
            {
                { item }
            });

            response.Count.Should().Be(1);
        }
        public void MapEntityToModel()
        {
            var mapper = new DALPipelineStepStepRequirementMapper();
            PipelineStepStepRequirement item = new PipelineStepStepRequirement();

            item.SetProperties(1, "A", 1, true);
            ApiPipelineStepStepRequirementServerResponseModel response = mapper.MapEntityToModel(item);

            response.Details.Should().Be("A");
            response.Id.Should().Be(1);
            response.PipelineStepId.Should().Be(1);
            response.RequirementMet.Should().Be(true);
        }
Exemple #7
0
        public virtual PipelineStepStepRequirement MapModelToEntity(
            int id,
            ApiPipelineStepStepRequirementServerRequestModel model
            )
        {
            PipelineStepStepRequirement item = new PipelineStepStepRequirement();

            item.SetProperties(
                id,
                model.Details,
                model.PipelineStepId,
                model.RequirementMet);
            return(item);
        }
Exemple #8
0
        public void MapEFToBOList()
        {
            var mapper = new DALPipelineStepStepRequirementMapper();
            PipelineStepStepRequirement entity = new PipelineStepStepRequirement();

            entity.SetProperties("A", 1, 1, true);

            List <BOPipelineStepStepRequirement> response = mapper.MapEFToBO(new List <PipelineStepStepRequirement>()
            {
                entity
            });

            response.Count.Should().Be(1);
        }
Exemple #9
0
        public void MapEFToBO()
        {
            var mapper = new DALPipelineStepStepRequirementMapper();
            PipelineStepStepRequirement entity = new PipelineStepStepRequirement();

            entity.SetProperties("A", 1, 1, true);

            BOPipelineStepStepRequirement response = mapper.MapEFToBO(entity);

            response.Detail.Should().Be("A");
            response.Id.Should().Be(1);
            response.PipelineStepId.Should().Be(1);
            response.RequirementMet.Should().Be(true);
        }
Exemple #10
0
        public void MapBOToEF()
        {
            var mapper = new DALPipelineStepStepRequirementMapper();
            var bo     = new BOPipelineStepStepRequirement();

            bo.SetProperties(1, "A", 1, true);

            PipelineStepStepRequirement response = mapper.MapBOToEF(bo);

            response.Detail.Should().Be("A");
            response.Id.Should().Be(1);
            response.PipelineStepId.Should().Be(1);
            response.RequirementMet.Should().Be(true);
        }
Exemple #11
0
        public virtual async Task <CreateResponse <ApiPipelineStepStepRequirementServerResponseModel> > Create(
            ApiPipelineStepStepRequirementServerRequestModel model)
        {
            CreateResponse <ApiPipelineStepStepRequirementServerResponseModel> response = ValidationResponseFactory <ApiPipelineStepStepRequirementServerResponseModel> .CreateResponse(await this.PipelineStepStepRequirementModelValidator.ValidateCreateAsync(model));

            if (response.Success)
            {
                PipelineStepStepRequirement record = this.DalPipelineStepStepRequirementMapper.MapModelToEntity(default(int), model);
                record = await this.PipelineStepStepRequirementRepository.Create(record);

                response.SetRecord(this.DalPipelineStepStepRequirementMapper.MapEntityToModel(record));
                await this.mediator.Publish(new PipelineStepStepRequirementCreatedNotification(response.Record));
            }

            return(response);
        }
        public async void Get_ShouldReturnRecords()
        {
            var mock   = new ServiceMockFacade <IPipelineStepStepRequirementService, IPipelineStepStepRequirementRepository>();
            var record = new PipelineStepStepRequirement();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(record));
            var service = new PipelineStepStepRequirementService(mock.LoggerMock.Object,
                                                                 mock.MediatorMock.Object,
                                                                 mock.RepositoryMock.Object,
                                                                 mock.ModelValidatorMockFactory.PipelineStepStepRequirementModelValidatorMock.Object,
                                                                 mock.DALMapperMockFactory.DALPipelineStepStepRequirementMapperMock);

            ApiPipelineStepStepRequirementServerResponseModel response = await service.Get(default(int));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
Exemple #13
0
        public virtual ApiPipelineStepStepRequirementServerResponseModel MapEntityToModel(
            PipelineStepStepRequirement item)
        {
            var model = new ApiPipelineStepStepRequirementServerResponseModel();

            model.SetProperties(item.Id,
                                item.Details,
                                item.PipelineStepId,
                                item.RequirementMet);
            if (item.PipelineStepIdNavigation != null)
            {
                var pipelineStepIdModel = new ApiPipelineStepServerResponseModel();
                pipelineStepIdModel.SetProperties(
                    item.PipelineStepIdNavigation.Id,
                    item.PipelineStepIdNavigation.Name,
                    item.PipelineStepIdNavigation.PipelineStepStatusId,
                    item.PipelineStepIdNavigation.ShipperId);

                model.SetPipelineStepIdNavigation(pipelineStepIdModel);
            }

            return(model);
        }
Exemple #14
0
        public virtual async Task <UpdateResponse <ApiPipelineStepStepRequirementServerResponseModel> > Update(
            int id,
            ApiPipelineStepStepRequirementServerRequestModel model)
        {
            var validationResult = await this.PipelineStepStepRequirementModelValidator.ValidateUpdateAsync(id, model);

            if (validationResult.IsValid)
            {
                PipelineStepStepRequirement record = this.DalPipelineStepStepRequirementMapper.MapModelToEntity(id, model);
                await this.PipelineStepStepRequirementRepository.Update(record);

                record = await this.PipelineStepStepRequirementRepository.Get(id);

                ApiPipelineStepStepRequirementServerResponseModel apiModel = this.DalPipelineStepStepRequirementMapper.MapEntityToModel(record);
                await this.mediator.Publish(new PipelineStepStepRequirementUpdatedNotification(apiModel));

                return(ValidationResponseFactory <ApiPipelineStepStepRequirementServerResponseModel> .UpdateResponse(apiModel));
            }
            else
            {
                return(ValidationResponseFactory <ApiPipelineStepStepRequirementServerResponseModel> .UpdateResponse(validationResult));
            }
        }