public void Test_Hashtable_Add_SameKey() { Hashtable dict = new Hashtable(); dict.AddValue("abc", 1); string error = ExceptionHelper.ExecuteActionReturnErrorMessage(() => { dict.AddValue("abc", 1); }); string expected = "Key=abc"; Assert.IsTrue(error.IndexOf(expected) > 0); Exception exception = null; try { dict.AddValue("abc", 1); } catch (Exception ex) { exception = ex; } Assert.IsNotNull(exception); Assert.IsNotNull(exception.InnerException); Assert.IsInstanceOfType(exception, typeof(ArgumentException)); Assert.IsInstanceOfType(exception.InnerException, typeof(ArgumentException)); }