public void WithLZ4Compression_PreservesOtherProperties()
    {
        var mutated = NonDefaultOptions.WithCompression(MessagePackCompression.None);

        Assert.Equal(MessagePackCompression.None, mutated.Compression);
        Assert.Equal(NonDefaultOptions.OldSpec, mutated.OldSpec);
        Assert.Equal(NonDefaultOptions.AllowAssemblyVersionMismatch, mutated.AllowAssemblyVersionMismatch);
        Assert.Equal(NonDefaultOptions.OmitAssemblyVersion, mutated.OmitAssemblyVersion);
        Assert.Same((object)NonDefaultOptions.Resolver, (object)mutated.Resolver);
    }
Ejemplo n.º 2
0
        public LZ4MessagePackOutputFormatter(IFormatterResolver resolver)
        {
            SupportedMediaTypes.Add(ContentType);

            if (resolver == null)
            {
                _options = MessagePackSerializer.DefaultOptions;
            }
            else
            {
                _options = MessagePackSerializer.DefaultOptions.WithResolver(resolver);
            }

            _options = _options.WithCompression(MessagePackCompression.Lz4Block);
        }
Ejemplo n.º 3
0
 public MessagePackOutputFormatter(MessagePackSerializerOptions options = null)
 {
     _options = options ?? ContractlessStandardResolver.Options;
     _options = _options.WithCompression(MessagePackCompression.Lz4Block);
     SupportedMediaTypes.Add(new Microsoft.Net.Http.Headers.MediaTypeHeaderValue(_mediaType));
 }