public void TryToGetAndSendNewSosOnlineAlerts_HaveNeverCheckedForAlertsButSettingsSayNeverDownload_DoNotSendAlertToUi()
        {
            var sosOnlineService = new SosOnlineServiceFake();
            var settings = new SirenOfShameSettingsFake();
            settings.UpdateLocation = UpdateLocation.Never;
            settings.LastCheckedForAlert = null;
            NewAlertEventArgs newAlertEventArgs = null;
            sosOnlineService.TryToGetAndSendNewSosOnlineAlerts(settings, new DateTime(2010, 1, 1), alert =>
            {
                newAlertEventArgs = alert;
            });

            sosOnlineService.FakeWebClient.InvokeDownloadStringCompleted(@"56
            http://www.google.com
            Hello World
            633979872000000000");
            Assert.IsNull(newAlertEventArgs);
        }
Exemplo n.º 2
0
        public void TryToGetAndSendNewSosOnlineAlerts_HaveNeverCheckedForAlertsButSettingsSayNeverDownload_DoNotSendAlertToUi()
        {
            var sosOnlineService = new SosOnlineServiceFake();
            var settings         = new SirenOfShameSettingsFake();

            settings.UpdateLocation      = UpdateLocation.Never;
            settings.LastCheckedForAlert = null;
            NewAlertEventArgs newAlertEventArgs = null;

            sosOnlineService.TryToGetAndSendNewSosOnlineAlerts(settings, new DateTime(2010, 1, 1), alert =>
            {
                newAlertEventArgs = alert;
            });

            sosOnlineService.FakeWebClient.InvokeDownloadStringCompleted(@"56
http://www.google.com
Hello World
633979872000000000");
            Assert.IsNull(newAlertEventArgs);
        }
Exemplo n.º 3
0
        public void TryToGetAndSendNewSosOnlineAlerts_LastCheckedForNewAlertsOneSecondAgo_DoNotSendAlertToUi()
        {
            var sosOnlineService = new SosOnlineServiceFake();
            var settings = new SirenOfShameSettingsFake();
            var now = new DateTime(2010, 2, 2, 2, 2, 1);
            settings.LastCheckedForAlert = new DateTime(2010, 2, 2, 2, 2, 2);

            NewAlertEventArgs newAlertEventArgs = null;
            sosOnlineService.TryToGetAndSendNewSosOnlineAlerts(settings, now, alert =>
            {
                newAlertEventArgs = alert;
            });

            sosOnlineService.FakeWebClient.InvokeDownloadStringCompleted(@"56
            http://www.google.com
            Hello World
            633979872000000000");

            Assert.IsNull(newAlertEventArgs);
        }
Exemplo n.º 4
0
        public void TryToGetAndSendNewSosOnlineAlerts_HaveNeverCheckedForAlerts_SendAlertToUi()
        {
            var sosOnlineService = new SosOnlineServiceFake();
            var settings = new SirenOfShameSettingsFake();
            settings.LastCheckedForAlert = null;
            NewAlertEventArgs newAlertEventArgs = null;
            sosOnlineService.TryToGetAndSendNewSosOnlineAlerts(settings, new DateTime(2010, 1, 1), alert =>
            {
                newAlertEventArgs = alert;
            });

            sosOnlineService.FakeWebClient.InvokeDownloadStringCompleted(@"56
            http://www.google.com
            Hello World
            633979872000000000");

            Assert.IsNotNull(newAlertEventArgs, "Expected WebClient.DownloadStringAsync to be called, but it never was");
            Assert.AreEqual("Hello World", newAlertEventArgs.Message);
            Assert.AreEqual("http://www.google.com", newAlertEventArgs.Url);
            Assert.AreEqual(new DateTime(2010, 1, 2), newAlertEventArgs.AlertDate);
        }
Exemplo n.º 5
0
        public void TryToGetAndSendNewSosOnlineAlerts_LastCheckedForNewAlertsOneSecondAgo_DoNotSendAlertToUi()
        {
            var sosOnlineService = new SosOnlineServiceFake();
            var settings         = new SirenOfShameSettingsFake();
            var now = new DateTime(2010, 2, 2, 2, 2, 1);

            settings.LastCheckedForAlert = new DateTime(2010, 2, 2, 2, 2, 2);

            NewAlertEventArgs newAlertEventArgs = null;

            sosOnlineService.TryToGetAndSendNewSosOnlineAlerts(settings, now, alert =>
            {
                newAlertEventArgs = alert;
            });

            sosOnlineService.FakeWebClient.InvokeDownloadStringCompleted(@"56
http://www.google.com
Hello World
633979872000000000");

            Assert.IsNull(newAlertEventArgs);
        }
Exemplo n.º 6
0
        public void TryToGetAndSendNewSosOnlineAlerts_HaveNeverCheckedForAlerts_SendAlertToUi()
        {
            var sosOnlineService = new SosOnlineServiceFake();
            var settings         = new SirenOfShameSettingsFake();

            settings.LastCheckedForAlert = null;
            NewAlertEventArgs newAlertEventArgs = null;

            sosOnlineService.TryToGetAndSendNewSosOnlineAlerts(settings, new DateTime(2010, 1, 1), alert =>
            {
                newAlertEventArgs = alert;
            });

            sosOnlineService.FakeWebClient.InvokeDownloadStringCompleted(@"56
http://www.google.com
Hello World
633979872000000000");

            Assert.IsNotNull(newAlertEventArgs, "Expected WebClient.DownloadStringAsync to be called, but it never was");
            Assert.AreEqual("Hello World", newAlertEventArgs.Message);
            Assert.AreEqual("http://www.google.com", newAlertEventArgs.Url);
            Assert.AreEqual(new DateTime(2010, 1, 2), newAlertEventArgs.AlertDate);
        }