コード例 #1
0
        public void ShouldStripHtmlCommentsFromComplexContent()
        {
            var repo   = new DummySanitiserRepo(1);
            var engine = new MailSanitiserEngine(_coreDependencies, repo);
            var result = engine.SanitiseContent(_complexHtmlEmailContent, SanitiseContentType.Html & SanitiseContentType.PlainText);

            Assert.DoesNotContain("<!--", result);
            Assert.DoesNotContain("-->", result);
        }
コード例 #2
0
        public void ShouldStripAllHtml()
        {
            var repo   = new DummySanitiserRepo(1);
            var engine = new MailSanitiserEngine(_coreDependencies, repo);
            var result = engine.SanitiseContent(_emailHtmlContent, SanitiseContentType.Html);

            Assert.False(result.Contains('<'));
            Assert.False(result.Contains('>'));
        }
コード例 #3
0
        public void ShouldStripAllButBodyElementFromEmailHtmlAndRemoveMarkup()
        {
            var repo   = new DummySanitiserRepo(1);
            var engine = new MailSanitiserEngine(_coreDependencies, repo);
            var result = engine.SanitiseForAllContentTypes(_emailHtmlContent);

            Assert.DoesNotContain("<body", result.ToLowerInvariant());
            Assert.DoesNotContain("</body", result.ToLowerInvariant());
            Assert.False(result.Contains('<'));
            Assert.False(result.Contains('>'));
        }
コード例 #4
0
        public async Task MailSanitisationShouldOnlyProceedThroughFirstStepOfWorkflowWhenNoMailCollected()
        {
            var repo   = new DummySanitiserRepo(0);
            var engine = new MailSanitiserEngine(_coreDependencies, repo);
            var msg    = new GenericActionMessage();
            await engine.SanitiseMailAsync(msg);

            Assert.Equal(1, repo.MailCollectionCount);
            Assert.Equal(0, repo.StoreSanitisedMaiLCount);
            Assert.Equal(0, repo.ClearedMailCount);
            Assert.Equal(1, repo.LodgeMailAcknowledgementCount); // need to ensure the ack is still sent
        }
コード例 #5
0
        public async Task MailSanitisationShouldProceedThroughEntireWorkflowWhenMessagesAreCollected()
        {
            var repo   = new DummySanitiserRepo(2);
            var engine = new MailSanitiserEngine(_coreDependencies, repo);
            var msg    = new GenericActionMessage();
            await engine.SanitiseMailAsync(msg);

            Assert.Equal(1, repo.MailCollectionCount);
            Assert.Equal(1, repo.StoreSanitisedMaiLCount);
            Assert.Equal(1, repo.ClearedMailCount);
            Assert.Equal(1, repo.LodgeMailAcknowledgementCount);
            Assert.Equal(msg, repo.ActionMessageRecentlyLodged);
        }