public virtual CommunityActionTemplate MapBOToEF( BOCommunityActionTemplate bo) { CommunityActionTemplate efCommunityActionTemplate = new CommunityActionTemplate(); efCommunityActionTemplate.SetProperties( bo.ExternalId, bo.Id, bo.JSON, bo.Name); return(efCommunityActionTemplate); }
public virtual BOCommunityActionTemplate MapEFToBO( CommunityActionTemplate ef) { var bo = new BOCommunityActionTemplate(); bo.SetProperties( ef.Id, ef.ExternalId, ef.JSON, ef.Name); return(bo); }
public async Task <ApiCommunityActionTemplateResponseModel> ByName(string name) { CommunityActionTemplate record = await this.communityActionTemplateRepository.ByName(name); if (record == null) { return(null); } else { return(this.bolCommunityActionTemplateMapper.MapBOToModel(this.dalCommunityActionTemplateMapper.MapEFToBO(record))); } }
public async Task <ApiCommunityActionTemplateResponseModel> ByExternalId(Guid externalId) { CommunityActionTemplate record = await this.communityActionTemplateRepository.ByExternalId(externalId); if (record == null) { return(null); } else { return(this.bolCommunityActionTemplateMapper.MapBOToModel(this.dalCommunityActionTemplateMapper.MapEFToBO(record))); } }
private async Task <bool> BeUniqueByName(ApiCommunityActionTemplateRequestModel model, CancellationToken cancellationToken) { CommunityActionTemplate record = await this.communityActionTemplateRepository.ByName(model.Name); if (record == null || (this.existingRecordId != default(string) && record.Id == this.existingRecordId)) { return(true); } else { return(false); } }
public void MapEFToBOList() { var mapper = new DALCommunityActionTemplateMapper(); CommunityActionTemplate entity = new CommunityActionTemplate(); entity.SetProperties(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), "A", "A", "A"); List <BOCommunityActionTemplate> response = mapper.MapEFToBO(new List <CommunityActionTemplate>() { entity }); response.Count.Should().Be(1); }
public void MapEFToBO() { var mapper = new DALCommunityActionTemplateMapper(); CommunityActionTemplate entity = new CommunityActionTemplate(); entity.SetProperties(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), "A", "A", "A"); BOCommunityActionTemplate response = mapper.MapEFToBO(entity); response.ExternalId.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); response.Id.Should().Be("A"); response.JSON.Should().Be("A"); response.Name.Should().Be("A"); }
public void MapBOToEF() { var mapper = new DALCommunityActionTemplateMapper(); var bo = new BOCommunityActionTemplate(); bo.SetProperties("A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), "A", "A"); CommunityActionTemplate response = mapper.MapBOToEF(bo); response.ExternalId.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); response.Id.Should().Be("A"); response.JSON.Should().Be("A"); response.Name.Should().Be("A"); }
public async void Get() { var mock = new ServiceMockFacade <ICommunityActionTemplateRepository>(); var record = new CommunityActionTemplate(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult(record)); var service = new CommunityActionTemplateService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.CommunityActionTemplateModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLCommunityActionTemplateMapperMock, mock.DALMapperMockFactory.DALCommunityActionTemplateMapperMock); ApiCommunityActionTemplateResponseModel response = await service.Get(default(string)); response.Should().NotBeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <string>())); }