Example #1
0
        public void StopIfNotInternet()
        {
            connectionMock.SetupAllProperties();
            loginMock.SetupAllProperties();

            var crawler = new Crawler(null, connectionMock.Object, loginMock.Object, null, null, null);
            crawler.ProcessGroup(TestUrl);

            connectionMock.Verify(m => m.IsConnected(), Times.Once);
            loginMock.Verify(m => m.Login(), Times.Never);
        }
Example #2
0
        public void StopIfLoginFailed()
        {
            connectionMock.Setup(m => m.IsConnected()).Returns(true);
            loginMock.SetupAllProperties();
            converterMock.SetupAllProperties();

            var crawler = new Crawler(new VkApi(), connectionMock.Object, loginMock.Object, converterMock.Object, null, null);
            crawler.ProcessGroup(TestUrl);

            connectionMock.Verify(m => m.IsConnected(), Times.Once);
            loginMock.Verify(m => m.Login(), Times.Once);
            converterMock.Verify(m => m.GetGroupIdByUrl(TestUrl), Times.Never);
        }
Example #3
0
        public void StopIfGroupNotFound()
        {
            connectionMock.Setup(m => m.IsConnected()).Returns(true);
            loginMock.Setup(m => m.Login()).Returns(true);
            converterMock.SetupAllProperties();
            dataProviderMock.SetupAllProperties();

            var crawler = new Crawler(null, connectionMock.Object, loginMock.Object, converterMock.Object,
                dataProviderMock.Object, null);
            crawler.ProcessGroup(TestUrl);

            connectionMock.Verify(m => m.IsConnected(), Times.Once);
            loginMock.Verify(m => m.Login(), Times.Once);
            converterMock.Verify(m => m.GetGroupIdByUrl(TestUrl), Times.Once);
            dataProviderMock.Verify(m => m.SaveChanges(), Times.Never);
        }