예제 #1
0
        public void TestGuid()
        {
            // arrange
            var serializer = new DefaultNaturalKeySerializer();
            var naturalKey = Guid.NewGuid();

            // act
            var serializedNaturalKey   = serializer.Serialize(typeof(Guid), naturalKey);
            var deserializedNaturalKey = serializer.Deserialize(typeof(Guid), serializedNaturalKey);

            // assert
            Assert.Equal(naturalKey, deserializedNaturalKey);
        }
예제 #2
0
        public void TestSensibleValueObject()
        {
            // arrange
            var serializer = new DefaultNaturalKeySerializer();
            var naturalKey = new SensibleValueObject("Key");

            // act
            var serializedNaturalKey   = serializer.Serialize(typeof(SensibleValueObject), naturalKey);
            var deserializedNaturalKey = serializer.Deserialize(typeof(SensibleValueObject), serializedNaturalKey);

            // assert
            Assert.Equal(naturalKey, deserializedNaturalKey);
        }
예제 #3
0
        public void TestString()
        {
            // arrange
            var serializer = new DefaultNaturalKeySerializer();
            var naturalKey = "Key";

            // act
            var serializedNaturalKey   = serializer.Serialize(typeof(string), naturalKey);
            var deserializedNaturalKey = serializer.Deserialize(typeof(string), serializedNaturalKey);

            // assert
            Assert.Equal(naturalKey, deserializedNaturalKey);
        }