public void GzJsonSerializer_List() { // arrange var serializer = new GzJsonCacheSerializer(); 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); }
public void Serializer_FullAddGet <T>(T cache) where T : ICacheManager <object> { using (cache) { // arrange var key = Guid.NewGuid().ToString(); var pocco = SerializerPoccoSerializable.Create(); // act Func <bool> actSet = () => cache.Add(key, pocco); // assert actSet().Should().BeTrue("Should add the key"); cache.Get <SerializerPoccoSerializable>(key).ShouldBeEquivalentTo(pocco); } }
public void ProtoBufSerializer_FullAddGet() { using (var cache = TestManagers.CreateRedisCache(serializer: Serializer.Proto)) { // arrange var key = Guid.NewGuid().ToString(); var pocco = SerializerPoccoSerializable.Create(); // act Action actSet = () => { cache.Add(key, pocco); }; // assert actSet.ShouldNotThrow(); cache.Get <SerializerPoccoSerializable>(key).ShouldBeEquivalentTo(pocco); } }
public void Serializer_FullAddGet <T>(T cache) where T : ICacheManager <object> { using (cache) { // arrange var key = Guid.NewGuid().ToString(); var pocco = SerializerPoccoSerializable.Create(); // act Action actSet = () => { cache.Add(key, pocco); }; // assert actSet.ShouldNotThrow(); cache.Get <SerializerPoccoSerializable>(key).ShouldBeEquivalentTo(pocco); } }