예제 #1
0
        public void SerializeAndDeserialize2()
        {
            // arange
            GRYLogConfiguration logConfiguration = new() { Name = "MyLog" };

            // act
            string serializedLogConfiguration            = Generic.GenericSerialize(logConfiguration);
            GRYLogConfiguration logConfigurationReloaded = Generic.GenericDeserialize <GRYLogConfiguration>(serializedLogConfiguration);

            // assert
            Assert.AreEqual(logConfiguration, logConfigurationReloaded);
            Assert.AreEqual(logConfiguration.GetHashCode(), logConfigurationReloaded.GetHashCode());
            Assert.IsTrue(Generic.GenericEquals(logConfiguration, logConfigurationReloaded));
            Assert.AreEqual(Generic.GenericGetHashCode(logConfiguration), Generic.GenericGetHashCode(logConfigurationReloaded));
        }
    }
예제 #2
0
        public void SerializeAndDeserialize1()
        {
            // arange
            GRYLogConfiguration logConfiguration = new()
            {
                Name = "MyLog",
                ConvertTimeForLogentriesToUTCFormat = true
            };

            // act
            SimpleGenericXMLSerializer <GRYLogConfiguration> serializer = new();
            string serializedLogConfiguration = serializer.Serialize(logConfiguration);

            SimpleGenericXMLSerializer <GRYLogConfiguration> deserializer = new();
            GRYLogConfiguration logConfigurationReloaded = deserializer.Deserialize(serializedLogConfiguration);

            // assert
            Assert.AreEqual(logConfiguration, logConfigurationReloaded);
            Assert.AreEqual(logConfiguration.GetHashCode(), logConfigurationReloaded.GetHashCode());
            Assert.IsTrue(Generic.GenericEquals(logConfiguration, logConfigurationReloaded));
            Assert.AreEqual(Generic.GenericGetHashCode(logConfiguration), Generic.GenericGetHashCode(logConfigurationReloaded));
        }