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()); }