Commit 8923ed61 authored by Nick Craver's avatar Nick Craver

Move deprecated tests to one place, add WriteBuffer tests

Also removes the 4096 value and set it to always-zero, since that's the effective behavior until removal.
parent b34c858b
using System;
using Xunit;
using Xunit.Abstractions;
namespace StackExchange.Redis.Tests
{
/// <summary>
/// Testing that things we depcreate still parse, but are otherwise defaults.
/// </summary>
public class Deprecated : TestBase
{
public Deprecated(ITestOutputHelper output) : base(output) { }
#pragma warning disable CS0618 // Type or member is obsolete
[Fact]
public void PreserveAsyncOrder()
{
Assert.True(Attribute.IsDefined(typeof(ConfigurationOptions).GetProperty(nameof(ConfigurationOptions.PreserveAsyncOrder)), typeof(ObsoleteAttribute)));
var options = ConfigurationOptions.Parse("name=Hello");
Assert.False(options.PreserveAsyncOrder);
options = ConfigurationOptions.Parse("preserveAsyncOrder=true");
Assert.Equal("", options.ToString());
Assert.False(options.PreserveAsyncOrder);
options = ConfigurationOptions.Parse("preserveAsyncOrder=false");
Assert.Equal("", options.ToString());
Assert.False(options.PreserveAsyncOrder);
}
[Fact]
public void WriteBufferParse()
{
Assert.True(Attribute.IsDefined(typeof(ConfigurationOptions).GetProperty(nameof(ConfigurationOptions.WriteBuffer)), typeof(ObsoleteAttribute)));
var options = ConfigurationOptions.Parse("name=Hello");
Assert.Equal(0, options.WriteBuffer);
options = ConfigurationOptions.Parse("writeBuffer=8092");
Assert.Equal(0, options.WriteBuffer);
}
#pragma warning restore CS0618 // Type or member is obsolete
}
}
using Xunit;
using Xunit.Abstractions;
namespace StackExchange.Redis.Tests.Issues
{
public class Issue791 : TestBase
{
public Issue791(ITestOutputHelper output) : base(output) { }
[Fact]
public void PreserveAsyncOrderImplicitValue_ParsedFromConnectionString()
{
// We only care that it parses successfully while deprecated
var options = ConfigurationOptions.Parse("preserveAsyncOrder=true");
Assert.Equal("", options.ToString());
// We only care that it parses successfully while deprecated
options = ConfigurationOptions.Parse("preserveAsyncOrder=false");
Assert.Equal("", options.ToString());
}
[Fact]
public void DefaultValue_IsTrue()
{
var options = ConfigurationOptions.Parse("ssl=true");
}
[Fact]
public void PreserveAsyncOrder_SetConnectionMultiplexerProperty()
{
using (var multiplexer = ConnectionMultiplexer.Connect(TestConfig.Current.MasterServerAndPort + ",preserveAsyncOrder=false"))
{
// We only care that it parses successfully while deprecated
}
}
}
}
...@@ -362,7 +362,7 @@ public bool PreserveAsyncOrder ...@@ -362,7 +362,7 @@ public bool PreserveAsyncOrder
/// The size of the output buffer to use /// The size of the output buffer to use
/// </summary> /// </summary>
[Obsolete("This setting no longer has any effect, and should not be used")] [Obsolete("This setting no longer has any effect, and should not be used")]
public int WriteBuffer { get { return writeBuffer.GetValueOrDefault(4096); } set { writeBuffer = value; } } public int WriteBuffer { get { return 0; } set { } }
internal LocalCertificateSelectionCallback CertificateSelectionCallback { get { return CertificateSelection; } private set { CertificateSelection = value; } } internal LocalCertificateSelectionCallback CertificateSelectionCallback { get { return CertificateSelection; } private set { CertificateSelection = value; } }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment