Ejemplo n.º 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");
        }
Ejemplo n.º 2
0
 private static async Task SetupConfiguration() =>
 await DatabaseHelpers.CreateConfiguration(new Dictionary <string, string>
 {
     { "nearbyDistance", "3.5" },
     { "shortLeadTimeSpaces", "2" },
     { "totalSpaces", "9" }
 });
Ejemplo n.º 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"]);
        }
Ejemplo n.º 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"]);
        }