public void GetOfflineSitesToBeReported_ReturnsSitesToBeReportedOffline()
        {
            List<SiteDetails> offlineSitesToBeReported = new List<SiteDetails>();
            offlineSitesToBeReported.Add(new SiteDetails("offlineSite1", "orgName", "testHealthboard", "testSupplier", "testReference", DateTime.Now));
            offlineSitesToBeReported.Add(new SiteDetails("offlineSite2", "orgName", "testHealthboard", "testSupplier", "testReference", DateTime.Now));
            offlineSitesToBeReported.Add(new SiteDetails("offlineSite3", "orgName", "testHealthboard", "testSupplier", "testReference", DateTime.Now));

            int numberOfOfflineSitesPerHealthboardLimit = 5;
            List<string> healthboardsThatHaveExceededNumberOfOfflineSitesToBeReportedLimit = new List<string>();

            // Setup repository to return offline sites to be reported
            repositoryMock.Setup(x => x.GetNumberOfOfflineSitesToBeReportedPerHealthboardLimit()).Returns(numberOfOfflineSitesPerHealthboardLimit);
            repositoryMock.Setup(x => x.GetHealthboardsThatHaveExceededNumberOfOfflineSitesToBeReportedLimit(numberOfOfflineSitesPerHealthboardLimit))
                .Returns(healthboardsThatHaveExceededNumberOfOfflineSitesToBeReportedLimit);
            repositoryMock.Setup(x => x.GetOfflineSitesToReport(healthboardsThatHaveExceededNumberOfOfflineSitesToBeReportedLimit))
                .Returns(offlineSitesToBeReported);

            CheckOfflineNotificationsShouldBeSent checkOfflineNotificationsShouldBeSent = new CheckOfflineNotificationsShouldBeSent(repository);

            List<SiteDetails> result;
            result = checkOfflineNotificationsShouldBeSent.GetOfflineSitesToBeReported;

            Assert.AreEqual(3, result.Count);
            Assert.AreEqual(offlineSitesToBeReported, result);
        }
        public void GetSuppliersToReceiveOfflineNotifications_NoSuppliersSetupToReceiveNotifications_ReturnsEmptyList()
        {
            List<string> suppliersToReceiveNotifications = new List<string>();

            // Setup repository to return no suppliers to receive offline notifications
            repositoryMock.Setup(x => x.GetSuppliersToReceiveOfflineNotifications()).Returns(suppliersToReceiveNotifications);

            CheckOfflineNotificationsShouldBeSent checkOfflineNotificationsShouldBeSent = new CheckOfflineNotificationsShouldBeSent(repository);

            List<string> result;
            result = checkOfflineNotificationsShouldBeSent.GetSuppliersToReceiveOfflineNotifications;

            Assert.AreEqual(0, result.Count);
        }
        public void GetOfflineSitesToBeReported_NoSitesToBeReported_ReturnsEmptyList()
        {
            List<SiteDetails> offlineSitesToBeReported = new List<SiteDetails>();
            int numberOfOfflineSitesPerHealthboardLimit = 5;
            List<string> healthboardsThatHaveExceededNumberOfOfflineSitesToBeReportedLimit = new List<string>();

            // Setup repository to return no offline sites to be reported
            repositoryMock.Setup(x => x.GetNumberOfOfflineSitesToBeReportedPerHealthboardLimit()).Returns(numberOfOfflineSitesPerHealthboardLimit);
            repositoryMock.Setup(x => x.GetHealthboardsThatHaveExceededNumberOfOfflineSitesToBeReportedLimit(numberOfOfflineSitesPerHealthboardLimit))
                .Returns(healthboardsThatHaveExceededNumberOfOfflineSitesToBeReportedLimit);
            repositoryMock.Setup(x => x.GetOfflineSitesToReport(healthboardsThatHaveExceededNumberOfOfflineSitesToBeReportedLimit))
                .Returns(offlineSitesToBeReported);

            CheckOfflineNotificationsShouldBeSent checkOfflineNotificationsShouldBeSent = new CheckOfflineNotificationsShouldBeSent(repository);

            List<SiteDetails> result;
            result = checkOfflineNotificationsShouldBeSent.GetOfflineSitesToBeReported;

            Assert.AreEqual(0, result.Count);
        }
        public void ShouldOfflineNotificationsBeSent_SuppliersToReceiveNotificationsAndOfflineSitesToBeReportedExist_ReturnsTrue()
        {
            List<string> suppliersToReceiveNotifications = new List<string>()
            {
                "supplier1", "supplier2", "supplier3"
            };

            List<SiteDetails> offlineSitesToBeReported = new List<SiteDetails>();
            offlineSitesToBeReported.Add(new SiteDetails("offlineSite1", "orgName", "testHealthboard", "testSupplier", "testReference", DateTime.Now));
            offlineSitesToBeReported.Add(new SiteDetails("offlineSite2", "orgName", "testHealthboard", "testSupplier", "testReference", DateTime.Now));
            offlineSitesToBeReported.Add(new SiteDetails("offlineSite3", "orgName", "testHealthboard", "testSupplier", "testReference", DateTime.Now));

            int numberOfOfflineSitesPerHealthboardLimit = 5;
            List<string> healthboardsThatHaveExceededNumberOfOfflineSitesToBeReportedLimit = new List<string>();

            // Setup repository to return suppliers to receive offline notifications
            repositoryMock.Setup(x => x.GetSuppliersToReceiveOfflineNotifications()).Returns(suppliersToReceiveNotifications);
            // Setup repository to return offline sites to be reported
            repositoryMock.Setup(x => x.GetNumberOfOfflineSitesToBeReportedPerHealthboardLimit()).Returns(numberOfOfflineSitesPerHealthboardLimit);
            repositoryMock.Setup(x => x.GetHealthboardsThatHaveExceededNumberOfOfflineSitesToBeReportedLimit(numberOfOfflineSitesPerHealthboardLimit))
                .Returns(healthboardsThatHaveExceededNumberOfOfflineSitesToBeReportedLimit);
            repositoryMock.Setup(x => x.GetOfflineSitesToReport(healthboardsThatHaveExceededNumberOfOfflineSitesToBeReportedLimit))
                .Returns(offlineSitesToBeReported);

            CheckOfflineNotificationsShouldBeSent checkOfflineNotificationsShouldBeSent = new CheckOfflineNotificationsShouldBeSent(repository);

            bool result;
            result = checkOfflineNotificationsShouldBeSent.ShouldOfflineNotificationsBeSent;

            Assert.IsTrue(result);
        }
        public void ShouldOfflineNotificationsBeSent_NoOfflineSitesToBeReported_ReturnsFalse()
        {
            List<string> suppliersToReceiveNotifications = new List<string>()
            {
                "supplier1", "supplier2", "supplier3"
            };
            List<SiteDetails> offlineSitesToBeReported = new List<SiteDetails>();
            int numberOfOfflineSitesPerHealthboardLimit = 5;
            List<string> healthboardsThatHaveExceededNumberOfOfflineSitesToBeReportedLimit = new List<string>();

            // Setup repository to return suppliers to receive offline notifications
            repositoryMock.Setup(x => x.GetSuppliersToReceiveOfflineNotifications()).Returns(suppliersToReceiveNotifications);
            // Setup repository to return no offline sites to be reported
            repositoryMock.Setup(x => x.GetNumberOfOfflineSitesToBeReportedPerHealthboardLimit()).Returns(numberOfOfflineSitesPerHealthboardLimit);
            repositoryMock.Setup(x => x.GetHealthboardsThatHaveExceededNumberOfOfflineSitesToBeReportedLimit(numberOfOfflineSitesPerHealthboardLimit))
                .Returns(healthboardsThatHaveExceededNumberOfOfflineSitesToBeReportedLimit);
            repositoryMock.Setup(x => x.GetOfflineSitesToReport(healthboardsThatHaveExceededNumberOfOfflineSitesToBeReportedLimit))
                .Returns(offlineSitesToBeReported);

            CheckOfflineNotificationsShouldBeSent checkOfflineNotificationsShouldBeSent = new CheckOfflineNotificationsShouldBeSent(repository);

            bool result;
            result = checkOfflineNotificationsShouldBeSent.ShouldOfflineNotificationsBeSent;

            Assert.IsFalse(result);
        }