Exemple #1
0
        public void TempF_330_CreateAndReadXml_during()
        {
            // Testing the "during" operator

            // Creating a time range
            var start     = ParseDateTimeInUtc("2018-04-18T03:23:11Z");
            var end       = ParseDateTimeInUtc("2018-05-18T03:23:11Z");
            var timeRange = new Item_TimeRange(start, end);

            var testObject = new TemporalFilter(TemporalFilter.ValueReferenceType.PhenomenonTime, TemporalFilter.OperatorType.During, timeRange);

            // Serialise and read
            var testObjectIn = SerialiseAndRead(testObject);

            // Asserting value reference
            Assert.AreEqual(TemporalFilter.ValueReferenceType.PhenomenonTime, testObjectIn.ValueReference);

            // Asserting operator
            Assert.AreEqual(TemporalFilter.OperatorType.During, testObjectIn.Operator);

            // Expecting a time range
            var timeRangeIn = (Item_TimeRange)testObjectIn.Time;

            AssertDateTime(start, timeRangeIn.Start);
            AssertDateTime(end, timeRangeIn.End);
        }
Exemple #2
0
        public void TempF_100_Create()
        {
            // Testing how the constructor works with invalid input

            var baseTime = DateTime.Now.ToUniversalTime();

            var timeRange1   = new Item_TimeRange(baseTime, baseTime.AddHours(1));
            var timeInstant1 = new Item_TimeInstant(baseTime);

            // These operators require a time instant as the operand
            AssertCtorException(TemporalFilter.OperatorType.After, timeRange1);
            AssertCtorException(TemporalFilter.OperatorType.Before, timeRange1);

            // These operators require a time range as the operand
            AssertCtorException(TemporalFilter.OperatorType.During, timeInstant1);
        }