Commit 6718f8a9 authored by Marc Gravell's avatar Marc Gravell

Issue 25: improved handling of configuration strings

parent 59e54f53
......@@ -42,7 +42,7 @@ public void AsyncTasksReportFailureIfServerUnavailable()
Assert.IsTrue(c.IsFaulted, "faulted");
var ex = c.Exception.InnerExceptions.Single();
Assert.IsInstanceOf<RedisConnectionException>(ex);
Assert.AreEqual("No connection is available to service this operation: SADD", ex.Message);
Assert.AreEqual("No connection is available to service this operation: SADD AsyncTasksReportFailureIfServerUnavailable", ex.Message);
}
}
#endif
......
......@@ -293,7 +293,7 @@ public void GetWithExpiry(bool exists, bool hasExpiry)
}
}
[Test]
[ExpectedException(typeof(RedisServerException), ExpectedMessage = "ERR Operation against a key holding the wrong kind of value")]
[ExpectedException(typeof(RedisServerException), ExpectedMessage = "WRONGTYPE Operation against a key holding the wrong kind of value")]
public void GetWithExpiryWrongTypeAsync()
{
using (var conn = Create())
......@@ -315,7 +315,7 @@ public void GetWithExpiryWrongTypeAsync()
}
[Test]
[ExpectedException(typeof(RedisServerException), ExpectedMessage = "ERR Operation against a key holding the wrong kind of value")]
[ExpectedException(typeof(RedisServerException), ExpectedMessage = "WRONGTYPE Operation against a key holding the wrong kind of value")]
public void GetWithExpiryWrongTypeSync()
{
using (var conn = Create())
......
......@@ -11,6 +11,7 @@ public void Basic()
{
var config = ConfigurationOptions.Parse(".,$PING=p");
Assert.AreEqual(1, config.EndPoints.Count);
config.SetDefaultPorts();
Assert.Contains(new DnsEndPoint(".",6379), config.EndPoints);
var map = config.CommandMap;
Assert.AreEqual("$PING=p", map.ToString());
......
using NUnit.Framework;
using System;
namespace StackExchange.Redis.Tests.Issues
{
[TestFixture]
public class Issue25 : TestBase
{
[Test]
public void CaseInsensitive()
{
var options = ConfigurationOptions.Parse("ssl=true");
Assert.IsTrue(options.Ssl);
Assert.AreEqual("ssl=True", options.ToString());
options = ConfigurationOptions.Parse("SSL=TRUE");
Assert.IsTrue(options.Ssl);
Assert.AreEqual("ssl=True", options.ToString());
}
[Test]
public void UnkonwnKeywordHandling_Ignore()
{
var options = ConfigurationOptions.Parse("ssl2=true", true);
}
[Test, ExpectedException(typeof(ArgumentException), ExpectedMessage = "Keyword 'ssl2' is not supported")]
public void UnkonwnKeywordHandling_ExplicitFail()
{
var options = ConfigurationOptions.Parse("ssl2=true", false);
}
[Test, ExpectedException(typeof(ArgumentException), ExpectedMessage = "Keyword 'ssl2' is not supported")]
public void UnkonwnKeywordHandling_ImplicitFail()
{
var options = ConfigurationOptions.Parse("ssl2=true");
}
}
}
......@@ -72,6 +72,7 @@
<Compile Include="Config.cs" />
<Compile Include="FloatingPoint.cs" />
<Compile Include="Issues\BGSAVEResponse.cs" />
<Compile Include="Issues\Issue25.cs" />
<Compile Include="Issues\Issue6.cs" />
<Compile Include="Issues\SO22786599.cs" />
<Compile Include="Keys.cs" />
......
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