Example #1
0
        public void FindRecentAuthLink_WhenMessageWithSubjectFound_ButContainsNoLink_ShouldThrowException()
        {
            var mailStore   = CreateMailStoreMock("LoginLink", "error");
            var mailService = new Logics.Authentication.MailService(mailStore);

            TestDelegate action = () => { mailService.FindRecentAuthLink(); };

            Assert.Throws <CrawlerAuthenticationException>(action);
        }
Example #2
0
        public void FindRecentAuthLink_WhenNoMessagesFound_ShouldThrowException()
        {
            var mailStore   = CreateMailStoreMock(null, null);
            var mailService = new Logics.Authentication.MailService(mailStore);

            TestDelegate action = () => { mailService.FindRecentAuthLink(); };

            Assert.Throws <CrawlerAuthenticationException>(action);
        }
Example #3
0
        public void FindRecentAuthLink_WhenCorrectMessageWithSubjectFound_ShouldReturnLinkInText()
        {
            const string link        = "https://site.com/User/Login/session=dfskjg4857hwvo47yvtwp38ntv8o437nvw";
            var          mailStore   = CreateMailStoreMock("LoginLink", "text text " + link + " text text text");
            var          mailService = new Logics.Authentication.MailService(mailStore);

            var result = mailService.FindRecentAuthLink();

            Assert.That(result, Is.EqualTo(link));
        }