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);
        }
        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('>'));
        }
        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('>'));
        }
Exemplo n.º 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
        }
Exemplo n.º 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);
        }