public void Simple_Serialize_Deserialize_Test() { //Arrange var protoBufSerializer = new ProtoBufRedisCacheSerializer(); var objectToSerialize = new ClassToSerialize {Age = 10, Name = "John"}; //Act string classSerializedString = protoBufSerializer.Serialize( objectToSerialize, typeof(ClassToSerialize) ); object classUnSerialized = protoBufSerializer.Deserialize(classSerializedString); //Assert classUnSerialized.ShouldBeOfType<ClassToSerialize>(); ClassToSerialize classUnSerializedTyped = (ClassToSerialize) classUnSerialized; classUnSerializedTyped.Age.ShouldBe(10); classUnSerializedTyped.Name.ShouldBe("John"); }
public void Simple_Serialize_Deserialize_Test() { //Arrange var protoBufSerializer = new ProtoBufRedisCacheSerializer(); var objectToSerialize = new ClassToSerialize { Age = 10, Name = "John" }; //Act string classSerializedString = protoBufSerializer.Serialize( objectToSerialize, typeof(ClassToSerialize) ); object classUnSerialized = protoBufSerializer.Deserialize(classSerializedString); //Assert classUnSerialized.ShouldBeOfType <ClassToSerialize>(); ClassToSerialize classUnSerializedTyped = (ClassToSerialize)classUnSerialized; classUnSerializedTyped.Age.ShouldBe(10); classUnSerializedTyped.Name.ShouldBe("John"); }