Esempio n. 1
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"]);
        }
Esempio n. 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");
        }
Esempio n. 3
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"]);
        }