public virtual PipelineStepStatus MapBOToEF( BOPipelineStepStatus bo) { PipelineStepStatus efPipelineStepStatus = new PipelineStepStatus(); efPipelineStepStatus.SetProperties( bo.Id, bo.Name); return(efPipelineStepStatus); }
public virtual BOPipelineStepStatus MapEFToBO( PipelineStepStatus ef) { var bo = new BOPipelineStepStatus(); bo.SetProperties( ef.Id, ef.Name); return(bo); }
public virtual ApiPipelineStepStatusServerResponseModel MapEntityToModel( PipelineStepStatus item) { var model = new ApiPipelineStepStatusServerResponseModel(); model.SetProperties(item.Id, item.Name); return(model); }
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"); }
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"); }
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"); }
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"); }
public virtual PipelineStepStatus MapModelToEntity( int id, ApiPipelineStepStatusServerRequestModel model ) { PipelineStepStatus item = new PipelineStepStatus(); item.SetProperties( id, model.Name); return(item); }
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); }
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)); } }
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); }
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); }
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>())); }
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)); } }