public void Should_Not_Throw_If_ParamName_Is_The_Same(string actualParamName, string expectedParamName) { // Given var exception = new ArgumentException("Foo", actualParamName); // When exception.IsArgumentException(expectedParamName); // Then }
public void Should_Not_Throw_If_Exception_Type_Is_ArgumentException() { // Given var exception = new ArgumentException("Message", "Foo"); // When exception.IsArgumentException("Foo"); // Then }
public void Should_Throw_If_ParamName_Is_Different(string actualParamName, string expectedParamName) { // Given var exception = new ArgumentException("Foo", actualParamName); // When var result = Record.Exception(() => exception.IsArgumentException(expectedParamName)); // Then result.ShouldBeOfType <Exception>(); result.Message.ShouldBe($"Expected parameter name to be '{expectedParamName}' but was '{actualParamName}'."); }