Beispiel #1
0
        public async Task Sends_daily_summary_email()
        {
            await SetupSchedules(dailyNotificationDue : true);

            await DatabaseHelpers.CreateTrigger();

            await DatabaseHelpers.CreateConfiguration(new Dictionary <string, string>
            {
                { "nearbyDistance", "3.5" },
                { "shortLeadTimeSpaces", "0" },
                { "totalSpaces", "0" }
            });

            await DatabaseHelpers.CreateUser(
                CreateUser.With(userId: "User1", emailAddress: "*****@*****.**"));

            // Current instant is defined such that the next daily summary date is 02-Mar-2021
            await DatabaseHelpers.CreateRequests(
                "User1",
                "2021-03",
                new Dictionary <string, string> {
                { "02", "I" }
            });

            await TaskRunner.RunTasksAsync(CustomProviderFactory.CreateServiceProvider());

            await CheckSingleEmail("*****@*****.**", "Parking status for Tue 02 Mar: INTERRUPTED");
        }
Beispiel #2
0
        public async Task Allocates_requests()
        {
            await SetupSchedules();

            await DatabaseHelpers.CreateTrigger();

            await DatabaseHelpers.CreateUser(
                CreateUser.With(userId: "User1", emailAddress: "*****@*****.**"));

            await DatabaseHelpers.CreateRequests(
                "User1",
                "2021-03",
                new Dictionary <string, string> {
                { "01", "I" }
            });

            await TaskRunner.RunTasksAsync(CustomProviderFactory.CreateServiceProvider());

            var savedRequests = await DatabaseHelpers.ReadRequests("User1", "2021-03");

            Assert.Equal(new[] { "01" }, savedRequests.Keys);
            Assert.Equal("A", savedRequests["01"]);

            await CheckSingleEmail("*****@*****.**", "Parking space allocated for Mon 01 Mar");
        }
Beispiel #3
0
        public async Task PreProcesses_requests()
        {
            await SetupSchedules();

            await DatabaseHelpers.CreateConfiguration(new Dictionary <string, string>
            {
                { "nearbyDistance", "3.5" },
                { "shortLeadTimeSpaces", "0" },
                { "totalSpaces", "0" }
            });

            await DatabaseHelpers.CreateTrigger();

            await DatabaseHelpers.CreateUser(
                CreateUser.With(userId: "User1", emailAddress: "*****@*****.**"));

            await DatabaseHelpers.CreateRequests(
                "User1",
                "2021-03",
                new Dictionary <string, string> {
                { "02", "P" }
            });

            await TaskRunner.RunTasksAsync(CustomProviderFactory.CreateServiceProvider());

            var savedRequests = await DatabaseHelpers.ReadRequests("User1", "2021-03");

            Assert.Equal(new[] { "02" }, savedRequests.Keys);
            Assert.Equal("I", savedRequests["02"]);
        }
Beispiel #4
0
        public async Task Updates_soft_interruption_status()
        {
            await SetupSchedules(softInterruptionUpdaterDue : true);

            await DatabaseHelpers.CreateConfiguration(new Dictionary <string, string>
            {
                { "nearbyDistance", "3.5" },
                { "shortLeadTimeSpaces", "0" },
                { "totalSpaces", "0" }
            });

            await DatabaseHelpers.CreateTrigger();

            await DatabaseHelpers.CreateUser(
                CreateUser.With(userId: "User1", emailAddress: "*****@*****.**"));

            // Current instant is defined such that the next daily summary date is 02-Mar-2021
            await DatabaseHelpers.CreateRequests(
                "User1",
                "2021-03",
                new Dictionary <string, string> {
                { "02", "P" }
            });

            await TaskRunner.RunTasksAsync(CustomProviderFactory.CreateServiceProvider());

            var savedRequests = await DatabaseHelpers.ReadRequests("User1", "2021-03");

            Assert.Equal(new[] { "02" }, savedRequests.Keys);
            Assert.Equal("S", savedRequests["02"]);
        }
Beispiel #5
0
        public async Task Sends_weekly_summary_email()
        {
            await SetupSchedules(weeklyNotificationDue : true);

            await DatabaseHelpers.CreateTrigger();

            await DatabaseHelpers.CreateUser(
                CreateUser.With(userId: "User1", emailAddress: "*****@*****.**"));

            // Current instant is defined such that the next weekly summary date range is 08-Mar-2021 - 12-Mar-2021
            await DatabaseHelpers.CreateRequests(
                "User1",
                "2021-03",
                new Dictionary <string, string> {
                { "08", "I" }, { "12", "I" }
            });

            await TaskRunner.RunTasksAsync(CustomProviderFactory.CreateServiceProvider());

            await CheckSingleEmail("*****@*****.**", "Provisional parking status for Mon 08 Mar - Fri 12 Mar");
        }