コード例 #1
0
 protected override void Context()
 {
     _compression                    = A.Fake <IStringCompression>();
     _deserializedObject             = A.Fake <IObjectBase>();
     _underlyingSerializationManager = A.Fake <IStringSerializer>();
     _compressedString               = "aa";
     _uncompressedSting              = "bb";
     A.CallTo(() => _compression.Decompress(_compressedString)).Returns(_uncompressedSting);
     A.CallTo(() => _compression.Compress(_uncompressedSting)).Returns(_compressedString);
     A.CallTo(() => _underlyingSerializationManager.Deserialize <IObjectBase>(_uncompressedSting)).Returns(_deserializedObject);
     A.CallTo(() => _underlyingSerializationManager.Serialize(_deserializedObject)).Returns(_uncompressedSting);
     sut = new CompressedStringSerializer(_underlyingSerializationManager, _compression);
 }
コード例 #2
0
        protected override string[] ListFrom(string value)
        {
            var decompressedValue = _stringCompression.Decompress(value);

            return(base.ListFrom(decompressedValue));
        }
コード例 #3
0
 public TObject Deserialize <TObject>(string serializationString)
 {
     return(_underlyingSerializationManager.Deserialize <TObject>(_compression.Decompress(serializationString)));
 }