public void RemoveOnlineSites_NoOnlineSites_NothingRemoved()
        {
            List<string> offlineSites = AddOfflineSites(3);
            List<string> sitesRecordedAsOffline = AddOfflineSites(3);

            UpdateOfflineSiteData updateOfflineSiteData = new UpdateOfflineSiteData(repository);

            updateOfflineSiteData.RemoveOnlineSites(sitesRecordedAsOffline, offlineSites);

            repositoryMock.Verify(x => x.RemoveOnlineSite(It.IsAny<string>()), Times.Never());
        }
        public void GetSitesRecordedAsOffline_ReturnsSitesRecordedAsOffline()
        {
            List<string> sitesRecordedAsOffline = AddOfflineSites(3);

            repositoryMock.Setup(x => x.GetSitesRecordedAsOffline()).Returns(sitesRecordedAsOffline);

            UpdateOfflineSiteData updateOfflineSiteData = new UpdateOfflineSiteData(repository);

            List<string> result = new List<string>();
            result = updateOfflineSiteData.GetSitesRecordedAsOffline();

            Assert.AreEqual(sitesRecordedAsOffline, result);
        }
        public void RecordNewOfflineSites_RecordsNewOfflineSites()
        {
            string offlineSite4 = "offlineSite4";
            string offlineSite5 = "offlineSite5";

            List<string> offlineSites = AddOfflineSites(5);
            List<string> sitesRecordedAsOffline = AddOfflineSites(3);

            // Need to declare these setup methods or strictMock will throw exception
            repositoryMock.Setup(x => x.RecordNewOfflineSite(offlineSite4));
            repositoryMock.Setup(x => x.RecordNewOfflineSite(offlineSite5));

            UpdateOfflineSiteData updateOfflineSiteData = new UpdateOfflineSiteData(repository);

            updateOfflineSiteData.RecordNewOfflineSites(sitesRecordedAsOffline, offlineSites);

            repositoryMock.Verify(x => x.RecordNewOfflineSite(offlineSite4), Times.Once());
            repositoryMock.Verify(x => x.RecordNewOfflineSite(offlineSite5), Times.Once());
        }
        public void RemoveOnlineSites_OnlineSitesRemoved()
        {
            string onlineSite1 = "onlineSite1";
            string onlineSite2 = "onlineSite2";

            List<string> offlineSites = AddOfflineSites(3);
            List<string> sitesRecordedAsOffline = AddOfflineSites(3);
            sitesRecordedAsOffline.AddRange(AddOnlineSites(2));

            // Need to declare these setup methods or strictMock will throw exception
            repositoryMock.Setup(x => x.RemoveOnlineSite(onlineSite1));
            repositoryMock.Setup(x => x.RemoveOnlineSite(onlineSite2));

            UpdateOfflineSiteData updateOfflineSiteData = new UpdateOfflineSiteData(repository);

            updateOfflineSiteData.RemoveOnlineSites(sitesRecordedAsOffline, offlineSites);

            repositoryMock.Verify(x => x.RemoveOnlineSite(onlineSite1), Times.Once());
            repositoryMock.Verify(x => x.RemoveOnlineSite(onlineSite2), Times.Once());
        }
        public void UpdateSitesAlreadyRecordedAsOffline_UpdatesOfflineSites()
        {
            string offlineSite1 = "offlineSite1";
            string offlineSite2 = "offlineSite2";
            string offlineSite3 = "offlineSite3";

            List<string> offlineSites = AddOfflineSites(3);
            List<string> sitesRecordedAsOffline = AddOfflineSites(3);

            // Need to declare these setup methods or strictMock will throw exception
            repositoryMock.Setup(x => x.UpdateSiteAlreadyRecordedAsOffline(offlineSite1));
            repositoryMock.Setup(x => x.UpdateSiteAlreadyRecordedAsOffline(offlineSite2));
            repositoryMock.Setup(x => x.UpdateSiteAlreadyRecordedAsOffline(offlineSite3));

            UpdateOfflineSiteData updateOfflineSiteData = new UpdateOfflineSiteData(repository);

            updateOfflineSiteData.UpdateSitesAlreadyRecordedAsOffline(sitesRecordedAsOffline, offlineSites);

            repositoryMock.Verify(x => x.UpdateSiteAlreadyRecordedAsOffline(offlineSite1), Times.Once());
            repositoryMock.Verify(x => x.UpdateSiteAlreadyRecordedAsOffline(offlineSite2), Times.Once());
            repositoryMock.Verify(x => x.UpdateSiteAlreadyRecordedAsOffline(offlineSite3), Times.Once());
        }
        public void UpdateSitesAlreadyRecordedAsOffline_NoSitesRecordedAsOffline_NoSitesUpdated()
        {
            List<string> offlineSites = AddOfflineSites(3);
            List<string> sitesRecordedAsOffline = new List<string>();

            UpdateOfflineSiteData updateOfflineSiteData = new UpdateOfflineSiteData(repository);

            updateOfflineSiteData.UpdateSitesAlreadyRecordedAsOffline(sitesRecordedAsOffline, offlineSites);

            repositoryMock.Verify(x => x.UpdateSiteAlreadyRecordedAsOffline(It.IsAny<string>()), Times.Never());
        }