コード例 #1
0
        public void SerialisationAbstractObjects()
        {
            var nk = new NonKitClass()
            {
                TestProp = "Hello", Numbers = new List <int>()
                {
                    1, 2, 3, 4, 5
                }
            };
            var abs = new Abstract(nk);

            var transport = new MemoryTransport();

            var abs_serialized      = Operations.Serialize(abs);
            var abs_deserialized    = Operations.Deserialize(abs_serialized);
            var abs_se_deserializes = Operations.Serialize(abs_deserialized);

            Assert.AreEqual(abs.GetId(), abs_deserialized.GetId());
            Assert.AreEqual([email protected](), ((Abstract)abs_deserialized)[email protected]());
        }
コード例 #2
0
        public void AbstractHashing()
        {
            var nk1  = new NonKitClass();
            var abs1 = new Abstract(nk1);

            var nk2 = new NonKitClass()
            {
                TestProp = "HEllo"
            };
            var abs2 = new Abstract(nk2);

            var abs1H = abs1.GetId();
            var abs2H = abs2.GetId();

            Assert.AreNotEqual(abs1H, abs2H);

            nk1.TestProp = "Wow";

            Assert.AreNotEqual(abs1H, abs1.GetId());
        }