From 8f850f2a3e45d407747a5111d61bf8cf771d227d Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Wed, 30 Dec 2015 17:52:35 -0800 Subject: [PATCH] Remove dependency on Dictionary exception message We shouldn't test framework error messages. --- .../RouteValueDictionaryTests.cs | 26 ++++--------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/test/Microsoft.AspNet.Mvc.Routing.Abstractions.Tests/RouteValueDictionaryTests.cs b/test/Microsoft.AspNet.Mvc.Routing.Abstractions.Tests/RouteValueDictionaryTests.cs index 34e805c88d..299c90ff8c 100644 --- a/test/Microsoft.AspNet.Mvc.Routing.Abstractions.Tests/RouteValueDictionaryTests.cs +++ b/test/Microsoft.AspNet.Mvc.Routing.Abstractions.Tests/RouteValueDictionaryTests.cs @@ -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( - () => - { - var dictionary = new RouteValueDictionary(obj); - dictionary.Add("Hi", "There"); - }, - expected); + () => + { + var dictionary = new RouteValueDictionary(obj); + dictionary.Add("Hi", "There"); + }); } public static IEnumerable 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( - () => new Dictionary() - { - { "key", "value" }, - { "key", "value" } - }); - - return ex.Message; - } - private class RegularType { public bool IsAwesome { get; set; }