Skip to content

Reconciled exception messages #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions TestStack.FluentMVCTesting.Tests/ControllerExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void Check_for_unexpected_non_existent_temp_data_property()
_controller.ShouldHaveTempDataProperty(key));

Assert.That(exception.Message, Is.EqualTo(string.Format(
"Expected TempData to have a non-null value with key \"{0}\", but none found.", key)));
"Expected TempData to have a non-null value with key '{0}', but none found.", key)));
}

[Test]
Expand All @@ -85,7 +85,7 @@ public void Check_for_existent_temp_data_property_and_check_invalid_value()
var exception = Assert.Throws<TempDataAssertionException>(() =>
_controller.ShouldHaveTempDataProperty(key, expectedValue));

Assert.That(exception.Message, Is.EqualTo(string.Format("Expected value for key \"{0}\" to be \"{1}\", but instead found \"{2}\"", key, expectedValue, actualValue)));
Assert.That(exception.Message, Is.EqualTo(string.Format("Expected value for key '{0}' to be '{1}', but instead found '{2}'", key, expectedValue, actualValue)));
}

[Test]
Expand Down Expand Up @@ -144,7 +144,7 @@ public void Check_for_unexpected_non_existent_temp_data_property_when_supplied_w
_controller.ShouldHaveTempDataProperty<int>(key, x => x == 0));

Assert.That(exception.Message, Is.EqualTo(string.Format(
"Expected TempData to have a non-null value with key \"{0}\", but none found.", key)));
"Expected TempData to have a non-null value with key '{0}', but none found.", key)));
}

[Test]
Expand All @@ -164,7 +164,7 @@ public void Check_for_unexpected_existent_temp_data_property()
_controller.ShouldNotHaveTempDataProperty(Key));

Assert.That(exception.Message, Is.EqualTo(string.Format(
"Expected TempData to have no value with key \"{0}\", but found one.", Key)));
"Expected TempData to have no value with key '{0}', but found one.", Key)));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void Check_for_file_content_result_and_check_invalid_textual_contents()
var exception = Assert.Throws<ActionResultAssertionException>(() =>
_controller.WithCallTo(c => c.TextualFile()).ShouldRenderFileContents(contents));

Assert.That(exception.Message, Is.EqualTo(string.Format("Expected file contents to be \"{0}\", but instead was \"{1}\".", contents, ControllerResultTestController.TextualFileContent)));
Assert.That(exception.Message, Is.EqualTo(string.Format("Expected file contents to be '{0}', but instead was '{1}'.", contents, ControllerResultTestController.TextualFileContent)));
}

[Test]
Expand Down Expand Up @@ -309,7 +309,7 @@ public void Check_for_file_stream_result_and_check_invalid_textual_content()
var exception = Assert.Throws<ActionResultAssertionException>(() =>
_controller.WithCallTo(c => c.TextualStream()).ShouldRenderFileStream(contents));

Assert.That(exception.Message, Is.EqualTo(string.Format("Expected file contents to be \"{0}\", but instead was \"{1}\".", contents, ControllerResultTestController.TextualFileContent)));
Assert.That(exception.Message, Is.EqualTo(string.Format("Expected file contents to be '{0}', but instead was '{1}'.", contents, ControllerResultTestController.TextualFileContent)));
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void Check_for_content_result_and_check_invalid_content()

var exception = Assert.Throws<ActionResultAssertionException>(() => _controller.WithCallTo(c => c.Content()).ShouldReturnContent(content));

Assert.That(exception.Message, Is.EqualTo(string.Format("Expected content to be \"{0}\", but instead was \"{1}\".", content, ControllerResultTestController.TextualContent)));
Assert.That(exception.Message, Is.EqualTo(string.Format("Expected content to be '{0}', but instead was '{1}'.", content, ControllerResultTestController.TextualContent)));
}

[Test]
Expand All @@ -42,7 +42,7 @@ public void Check_for_content_result_and_check_content_and_check_invalid_content

var exception = Assert.Throws<ActionResultAssertionException>(() => _controller.WithCallTo(c => c.Content()).ShouldReturnContent(ControllerResultTestController.TextualContent, contentType));

Assert.That(exception.Message, Is.EqualTo(string.Format("Expected content type to be \"{0}\", but instead was \"{1}\".", contentType, ControllerResultTestController.ContentType)));
Assert.That(exception.Message, Is.EqualTo(string.Format("Expected content type to be '{0}', but instead was '{1}'.", contentType, ControllerResultTestController.ContentType)));
}

[Test]
Expand Down
8 changes: 4 additions & 4 deletions TestStack.FluentMVCTesting.Tests/TempDataResultTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void Check_for_unexpected_non_existent_temp_data_property()
_tempDataTest.AndShouldHaveTempDataProperty(key));

Assert.That(exception.Message, Is.EqualTo(string.Format(
"Expected TempData to have a non-null value with key \"{0}\", but none found.", key)));
"Expected TempData to have a non-null value with key '{0}', but none found.", key)));
}

[Test]
Expand All @@ -59,7 +59,7 @@ public void Check_for_existent_temp_data_property_and_check_invalid_value()
var exception = Assert.Throws<TempDataAssertionException>(() =>
_tempDataTest.AndShouldHaveTempDataProperty(key, expectedValue));

Assert.That(exception.Message, Is.EqualTo(string.Format("Expected value for key \"{0}\" to be \"{1}\", but instead found \"{2}\"", key, expectedValue, actualValue)));
Assert.That(exception.Message, Is.EqualTo(string.Format("Expected value for key '{0}' to be '{1}', but instead found '{2}'", key, expectedValue, actualValue)));
}

[Test]
Expand Down Expand Up @@ -117,7 +117,7 @@ public void Check_for_non_existent_temp_data_property_when_supplied_with_predica
_tempDataTest.AndShouldHaveTempDataProperty<int>(key, x => x == 0));

Assert.That(exception.Message, Is.EqualTo(string.Format(
"Expected TempData to have a non-null value with key \"{0}\", but none found.", key)));
"Expected TempData to have a non-null value with key '{0}', but none found.", key)));
}

[Test]
Expand All @@ -137,7 +137,7 @@ public void Check_for_unexpected_existent_temp_data_property()
_tempDataTest.AndShouldNotHaveTempDataProperty(Key));

Assert.That(exception.Message, Is.EqualTo(string.Format(
"Expected TempData to have no value with key \"{0}\", but found one.", Key)));
"Expected TempData to have no value with key '{0}', but found one.", Key)));
}

[Test]
Expand Down
8 changes: 4 additions & 4 deletions TestStack.FluentMvcTesting/ControllerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static TempDataResultTest ShouldHaveTempDataProperty(this ControllerBase
if (actual == null)
{
throw new TempDataAssertionException(string.Format(
"Expected TempData to have a non-null value with key \"{0}\", but none found.", key));
"Expected TempData to have a non-null value with key '{0}', but none found.", key));
}

if (value != null && actual.GetType() != value.GetType())
Expand All @@ -81,7 +81,7 @@ public static TempDataResultTest ShouldHaveTempDataProperty(this ControllerBase
if (value != null && !value.Equals(actual))
{
throw new TempDataAssertionException(string.Format(
"Expected value for key \"{0}\" to be \"{1}\", but instead found \"{2}\"", key, value, actual));
"Expected value for key '{0}' to be '{1}', but instead found '{2}'", key, value, actual));
}

return new TempDataResultTest(controller);
Expand All @@ -94,7 +94,7 @@ public static TempDataResultTest ShouldHaveTempDataProperty<TValue>(this Control
if (actual == null)
{
throw new TempDataAssertionException(string.Format(
"Expected TempData to have a non-null value with key \"{0}\", but none found.", key));
"Expected TempData to have a non-null value with key '{0}', but none found.", key));
}

if (!predicate((TValue)actual))
Expand All @@ -112,7 +112,7 @@ public static TempDataResultTest ShouldNotHaveTempDataProperty(this ControllerBa
if (actual != null)
{
throw new TempDataAssertionException(string.Format(
"Expected TempData to have no value with key \"{0}\", but found one.", key));
"Expected TempData to have no value with key '{0}', but found one.", key));
}

return new TempDataResultTest(controller);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public FileContentResult ShouldRenderFileContents(string contents, string conten
if (contents != reconstitutedText)
{
throw new ActionResultAssertionException(string.Format(
"Expected file contents to be \"{0}\", but instead was \"{1}\".",
"Expected file contents to be '{0}', but instead was '{1}'.",
contents,
reconstitutedText));
}
Expand Down Expand Up @@ -121,7 +121,7 @@ public FileStreamResult ShouldRenderFileStream(string contents, string contentTy
if (contents != reconstitutedText)
{
throw new ActionResultAssertionException(string.Format(
"Expected file contents to be \"{0}\", but instead was \"{1}\".",
"Expected file contents to be '{0}', but instead was '{1}'.",
contents,
reconstitutedText));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ public ContentResult ShouldReturnContent(string content = null, string contentTy
if (contentType != null && contentType != contentResult.ContentType)
{
throw new ActionResultAssertionException(string.Format(
"Expected content type to be \"{0}\", but instead was \"{1}\".",
"Expected content type to be '{0}', but instead was '{1}'.",
contentType,
contentResult.ContentType));
}

if (content != null && content != contentResult.Content)
{
throw new ActionResultAssertionException(string.Format(
"Expected content to be \"{0}\", but instead was \"{1}\".",
"Expected content to be '{0}', but instead was '{1}'.",
content,
contentResult.Content));
}
Expand Down