Example #1
0
        public void StartSymptomsBeforeSelfIsolationFailTest()
        {
            var zones = new AppSupportedTimeZones();

            var form = new IndexFormProc(_clock, zones.GetTzDbName("GMT"), "en-GB", false);

            Assert.Null(form.ValidateStartIsolation("01-01-2020 5:01 PM"));
            Assert.Contains("This value is before the start of your self-isolation", form.ValidateStartSymptoms("01-01-2019 5:01 PM"));

            Assert.False(form.IsValid());
        }
Example #2
0
        public void StartSymptomsAfterCurrentTimeFailTest()
        {
            var zones = new AppSupportedTimeZones();

            var form = new IndexFormProc(_clock, zones.GetTzDbName("GMT"), "en-GB", false);

            Assert.Null(form.ValidateStartIsolation("01-01-2020 5:35 PM"));
            Assert.Contains("This value is after the current time", form.ValidateStartSymptoms("01-01-2050 5:01 PM"));

            Assert.False(form.IsValid());
        }
Example #3
0
        public void EmptySymptomsTest()
        {
            var zones = new AppSupportedTimeZones();

            var form = new IndexFormProc(_clock, zones.GetTzDbName("GMT"), "en-GB", false);
            var tim  = new LocalDateTime(2020, 01, 1, 17, 35, 00).InZoneStrictly(_zoneGmt).ToInstant();

            Assert.Null(form.ValidateStartIsolation("01-01-2020 5:35 PM"));
            Assert.Null(form.ValidateStartSymptoms(""));

            Assert.True(form.IsValid());
            Assert.Equal(tim, form.StartIsolation);
            Assert.Null(form.StartSymptoms);
        }
Example #4
0
        public void SymptomsValidatedBeforeIsolationTest()
        {
            var zones = new AppSupportedTimeZones();

            var form = new IndexFormProc(_clock, zones.GetTzDbName("GMT"), "en-GB", false);
            var tim  = new LocalDateTime(2020, 01, 1, 17, 35, 00).InZoneStrictly(_zoneGmt).ToInstant();

            Assert.Contains("You must set the start of your self-isolation before giving the start of your symptoms", form.ValidateStartSymptoms("01-01-2020 5:01 PM"));
            Assert.False(form.IsValid());

            Assert.Null(form.ValidateStartIsolation("01-01-2020 5:35 PM"));
            Assert.Null(form.ValidateStartSymptoms("01-01-2020 5:35 PM"));

            Assert.True(form.IsValid());
            Assert.Equal(tim, form.StartIsolation);
            Assert.Equal(tim, form.StartSymptoms);
        }