Remove dependency on Dictionary exception message

We shouldn't test framework error messages.
This commit is contained in:
Ryan Nowak 2015-12-30 17:52:35 -08:00
parent a61a68defc
commit 8f850f2a3e
1 changed files with 5 additions and 21 deletions

View File

@ -160,17 +160,15 @@ namespace Microsoft.AspNet.Routing.Tests
public void CreateFromObject_MixedCaseThrows()
{
// Arrange
var expected = GetDuplicateKeyErrorMessage();
var obj = new { controller = "Home", Controller = "Home" };
// Act & Assert
ExceptionAssert.Throws<ArgumentException>(
() =>
{
var dictionary = new RouteValueDictionary(obj);
dictionary.Add("Hi", "There");
},
expected);
() =>
{
var dictionary = new RouteValueDictionary(obj);
dictionary.Add("Hi", "There");
});
}
public static IEnumerable<object[]> IEnumerableKeyValuePairData
@ -226,20 +224,6 @@ namespace Microsoft.AspNet.Routing.Tests
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
{
public bool IsAwesome { get; set; }