public void BinarySerializer_Primitives <T>(T value) { // arrange var serializer = new BinaryCacheSerializer(); // act var data = serializer.Serialize(value); var result = serializer.Deserialize(data, typeof(T)); result.Should().Be(value); }
public void BinarySerializer_Pocco() { // arrange var serializer = new BinaryCacheSerializer(); var item = SerializerPoccoSerializable.Create(); // act var data = serializer.Serialize(item); var result = serializer.Deserialize(data, item.GetType()); result.ShouldBeEquivalentTo(item); }
public void BinarySerializer_CacheItemWithPocco() { // arrange var serializer = new BinaryCacheSerializer(); var pocco = SerializerPoccoSerializable.Create(); var item = new CacheItem <SerializerPoccoSerializable>("key", "region", pocco, ExpirationMode.Absolute, TimeSpan.FromDays(1)); // act var data = serializer.SerializeCacheItem(item); var result = serializer.DeserializeCacheItem <SerializerPoccoSerializable>(data, pocco.GetType()); result.ShouldBeEquivalentTo(item); }
public void BinarySerializer_List() { // arrange var serializer = new BinaryCacheSerializer(); var items = new List <SerializerPoccoSerializable>() { SerializerPoccoSerializable.Create(), SerializerPoccoSerializable.Create(), SerializerPoccoSerializable.Create() }; // act var data = serializer.Serialize(items); var result = serializer.Deserialize(data, items.GetType()); result.ShouldBeEquivalentTo(items); }