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); }
private void TestTimeInstantFromFile(string filepath, TemporalFilter.ValueReferenceType valRef, TemporalFilter.OperatorType expectedOperator, DateTime expDateTime) { // Getting the proxy var xmlBytes = System.IO.File.ReadAllBytes(filepath); var proxy = DeserialiseAndGetProxy(xmlBytes); // Creating an object from the proxy var testObject = new TemporalFilter(proxy); // Asserting value reference Assert.AreEqual(valRef, testObject.ValueReference); // Asserting operator Assert.AreEqual(expectedOperator, testObject.Operator); // Expecting a time instant var timeInstant = (Item_TimeInstant)testObject.Time; AssertDateTime(expDateTime, timeInstant.Value); }