コード例 #1
0
        public virtual PipelineStepStatus MapBOToEF(
            BOPipelineStepStatus bo)
        {
            PipelineStepStatus efPipelineStepStatus = new PipelineStepStatus();

            efPipelineStepStatus.SetProperties(
                bo.Id,
                bo.Name);
            return(efPipelineStepStatus);
        }
コード例 #2
0
        public virtual BOPipelineStepStatus MapEFToBO(
            PipelineStepStatus ef)
        {
            var bo = new BOPipelineStepStatus();

            bo.SetProperties(
                ef.Id,
                ef.Name);
            return(bo);
        }
コード例 #3
0
        public virtual ApiPipelineStepStatusServerResponseModel MapEntityToModel(
            PipelineStepStatus item)
        {
            var model = new ApiPipelineStepStatusServerResponseModel();

            model.SetProperties(item.Id,
                                item.Name);

            return(model);
        }
コード例 #4
0
        public void MapModelToEntity()
        {
            var mapper = new DALPipelineStepStatusMapper();
            ApiPipelineStepStatusServerRequestModel model = new ApiPipelineStepStatusServerRequestModel();

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

            response.Name.Should().Be("A");
        }
コード例 #5
0
        public void MapEntityToModel()
        {
            var mapper = new DALPipelineStepStatusMapper();
            PipelineStepStatus item = new PipelineStepStatus();

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

            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }
コード例 #6
0
        public void MapEFToBO()
        {
            var mapper = new DALPipelineStepStatusMapper();
            PipelineStepStatus entity = new PipelineStepStatus();

            entity.SetProperties(1, "A");

            BOPipelineStepStatus response = mapper.MapEFToBO(entity);

            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }
コード例 #7
0
        public void MapBOToEF()
        {
            var mapper = new DALPipelineStepStatusMapper();
            var bo     = new BOPipelineStepStatus();

            bo.SetProperties(1, "A");

            PipelineStepStatus response = mapper.MapBOToEF(bo);

            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }
コード例 #8
0
        public virtual PipelineStepStatus MapModelToEntity(
            int id,
            ApiPipelineStepStatusServerRequestModel model
            )
        {
            PipelineStepStatus item = new PipelineStepStatus();

            item.SetProperties(
                id,
                model.Name);
            return(item);
        }
コード例 #9
0
        public void MapEntityToModelList()
        {
            var mapper = new DALPipelineStepStatusMapper();
            PipelineStepStatus item = new PipelineStepStatus();

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

            response.Count.Should().Be(1);
        }
コード例 #10
0
        public virtual async Task <ApiPipelineStepStatusServerResponseModel> Get(int id)
        {
            PipelineStepStatus record = await this.PipelineStepStatusRepository.Get(id);

            if (record == null)
            {
                return(null);
            }
            else
            {
                return(this.DalPipelineStepStatusMapper.MapEntityToModel(record));
            }
        }
コード例 #11
0
        public void MapEFToBOList()
        {
            var mapper = new DALPipelineStepStatusMapper();
            PipelineStepStatus entity = new PipelineStepStatus();

            entity.SetProperties(1, "A");

            List <BOPipelineStepStatus> response = mapper.MapEFToBO(new List <PipelineStepStatus>()
            {
                entity
            });

            response.Count.Should().Be(1);
        }
コード例 #12
0
        public virtual async Task <CreateResponse <ApiPipelineStepStatusServerResponseModel> > Create(
            ApiPipelineStepStatusServerRequestModel model)
        {
            CreateResponse <ApiPipelineStepStatusServerResponseModel> response = ValidationResponseFactory <ApiPipelineStepStatusServerResponseModel> .CreateResponse(await this.PipelineStepStatusModelValidator.ValidateCreateAsync(model));

            if (response.Success)
            {
                PipelineStepStatus record = this.DalPipelineStepStatusMapper.MapModelToEntity(default(int), model);
                record = await this.PipelineStepStatusRepository.Create(record);

                response.SetRecord(this.DalPipelineStepStatusMapper.MapEntityToModel(record));
                await this.mediator.Publish(new PipelineStepStatusCreatedNotification(response.Record));
            }

            return(response);
        }
コード例 #13
0
        public async void Get_ShouldReturnRecords()
        {
            var mock   = new ServiceMockFacade <IPipelineStepStatusService, IPipelineStepStatusRepository>();
            var record = new PipelineStepStatus();

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

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

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
コード例 #14
0
        public virtual async Task <UpdateResponse <ApiPipelineStepStatusServerResponseModel> > Update(
            int id,
            ApiPipelineStepStatusServerRequestModel model)
        {
            var validationResult = await this.PipelineStepStatusModelValidator.ValidateUpdateAsync(id, model);

            if (validationResult.IsValid)
            {
                PipelineStepStatus record = this.DalPipelineStepStatusMapper.MapModelToEntity(id, model);
                await this.PipelineStepStatusRepository.Update(record);

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

                ApiPipelineStepStatusServerResponseModel apiModel = this.DalPipelineStepStatusMapper.MapEntityToModel(record);
                await this.mediator.Publish(new PipelineStepStatusUpdatedNotification(apiModel));

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