public void SpfDomainStatsMapperShouldMapCorrectly() { SpfDomainStats spfDomainStat = new SpfDomainStats("ncsc.gov.uk", "testProvider", "192.168.72.11", "ncsc.gov.uk", 5, 10); SpfDomainStatsDto result = _spfDomainStatsMapper.Map(spfDomainStat, "testAlias", "testMarkdown"); Assert.That(result.Domain, Is.EqualTo("ncsc.gov.uk")); Assert.That(result.Provider, Is.EqualTo("testProvider")); Assert.That(result.Ip, Is.EqualTo("192.168.72.11")); Assert.That(result.SpfDomain, Is.EqualTo("ncsc.gov.uk")); Assert.That(result.SpfPass, Is.EqualTo(5)); Assert.That(result.SpfFail, Is.EqualTo(10)); Assert.That(result.ProviderAlias, Is.EqualTo("testAlias")); Assert.That(result.ProviderMarkdown, Is.EqualTo("testMarkdown")); }
public async Task CheckGetSpfDomainStatsDtoReturnsSpfDomainStatsDto() { string domain = "ncsc.gov.uk"; string ip = "192.168.72.11"; string spfDomain = "ncsc.gov.uk"; string provider = "testProvider"; string alias = "testAlias"; string markdown = "testMarkdown"; A.CallTo(() => _providerDetailsProvider.GetProviderAliasIn(alias)) .Returns(provider); A.CallTo(() => _providerDetailsProvider.GetProviderAliasOut(provider)) .Returns(alias); A.CallTo(() => _providerDetailsProvider.GetProviderMarkdown(provider)) .Returns(markdown); SpfDomainStats spfDomainStat = new SpfDomainStats(domain, provider, ip, spfDomain, 5, 10); List <SpfDomainStats> spfDomainStats = new List <SpfDomainStats>() { spfDomainStat }; A.CallTo(() => _aggregateReportApiDao.GetSpfDomainStats(domain, provider, ip, A <DateTime> ._, A <DateTime> ._)) .Returns(Task.FromResult(spfDomainStats)); SpfDomainStatsDto spfDomainStatsDto = new SpfDomainStatsDto(domain, provider, ip, spfDomain, 5, 10, alias, markdown); A.CallTo(() => _spfDomainStatsMapper.Map(spfDomainStat, alias, markdown)) .Returns(spfDomainStatsDto); List <SpfDomainStatsDto> spfDomainStatsDtoResult = await _aggregateReportService.GetSpfDomainStatsDto(domain, alias, ip, DateTime.MinValue, DateTime.MaxValue); Assert.AreSame(spfDomainStatsDto, spfDomainStatsDtoResult[0]); }
public SpfDomainStatsDto Map(SpfDomainStats spfDomainStats, string providerAlias, string providerMarkdown) { return(new SpfDomainStatsDto( spfDomainStats.Domain, spfDomainStats.Provider, spfDomainStats.Ip, spfDomainStats.SpfDomain, spfDomainStats.SpfPass, spfDomainStats.SpfFail, providerAlias, providerMarkdown)); }