Remove dependency on Dictionary exception message
We shouldn't test framework error messages.
This commit is contained in:
parent
a61a68defc
commit
8f850f2a3e
|
|
@ -160,17 +160,15 @@ namespace Microsoft.AspNet.Routing.Tests
|
||||||
public void CreateFromObject_MixedCaseThrows()
|
public void CreateFromObject_MixedCaseThrows()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var expected = GetDuplicateKeyErrorMessage();
|
|
||||||
var obj = new { controller = "Home", Controller = "Home" };
|
var obj = new { controller = "Home", Controller = "Home" };
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
ExceptionAssert.Throws<ArgumentException>(
|
ExceptionAssert.Throws<ArgumentException>(
|
||||||
() =>
|
() =>
|
||||||
{
|
{
|
||||||
var dictionary = new RouteValueDictionary(obj);
|
var dictionary = new RouteValueDictionary(obj);
|
||||||
dictionary.Add("Hi", "There");
|
dictionary.Add("Hi", "There");
|
||||||
},
|
});
|
||||||
expected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<object[]> IEnumerableKeyValuePairData
|
public static IEnumerable<object[]> IEnumerableKeyValuePairData
|
||||||
|
|
@ -226,20 +224,6 @@ namespace Microsoft.AspNet.Routing.Tests
|
||||||
Assert.Equal("Washington", ((Address)routeValueDictionary["Address"]).State);
|
Assert.Equal("Washington", ((Address)routeValueDictionary["Address"]).State);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetDuplicateKeyErrorMessage()
|
|
||||||
{
|
|
||||||
// Gets the exception message when duplicate entries are
|
|
||||||
// added to a Dictionary in a platform independent way
|
|
||||||
var ex = Assert.Throws<ArgumentException>(
|
|
||||||
() => new Dictionary<string, string>()
|
|
||||||
{
|
|
||||||
{ "key", "value" },
|
|
||||||
{ "key", "value" }
|
|
||||||
});
|
|
||||||
|
|
||||||
return ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class RegularType
|
private class RegularType
|
||||||
{
|
{
|
||||||
public bool IsAwesome { get; set; }
|
public bool IsAwesome { get; set; }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue