Example #1
0
        private void TestCreateAndReadTimeInstant(TemporalFilter.ValueReferenceType valueRef, TemporalFilter.OperatorType oper)
        {
            // This general test method tests the serialisation and deserialisation of
            // a filter that has a time instant operand

            // Creating a time instant
            var time        = ParseDateTimeInUtc("2018-01-18T03:23:34Z");
            var timeInstant = new Item_TimeInstant(time);

            var testObject = new TemporalFilter(valueRef, oper, timeInstant);

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

            // Asserting value reference
            Assert.AreEqual(valueRef, testObjectIn.ValueReference);

            // Asserting operator
            Assert.AreEqual(oper, testObjectIn.Operator);

            // Expecting a time instant
            var timeInstantIn = (Item_TimeInstant)testObjectIn.Time;

            AssertDateTime(time, timeInstantIn.Value);
        }
Example #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);
        }