Skip to content

Commit fde71ce

Browse files
NullNull
Null
authored and
Null
committed
Merge pull request #55 from ByteBlast/master
Reconciled quotation marks
2 parents 2ef1e3f + a7da32a commit fde71ce

File tree

8 files changed

+80
-68
lines changed

8 files changed

+80
-68
lines changed

BREAKING_CHANGES.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ You can read the original problem specification and discussion [here](https://g
2323

2424
If your project has been impacted by this particular breaking change, you might consider reevaluate the correctness of the affected tests.
2525

26+
## Error Messages
27+
28+
Some error messages surrounded actual values in double quotes. Others surrounded the values in single quotes. In version 3.0.0 *all* values are surrounded in single quotes.
29+
30+
### Reason
31+
32+
Consistency.
33+
34+
### Fix
35+
36+
Amend all effected tests to expect single quotes instead of double quotes.
37+
2638
# Version 2.0.0
2739

2840
## ShouldRenderFileStream Method

TestStack.FluentMVCTesting.Tests/ControllerExtensionsTests.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ public void Check_for_unexpected_non_existent_temp_data_property()
5858
const string key = "";
5959

6060
var exception = Assert.Throws<TempDataAssertionException>(() =>
61-
_controller.ShouldHaveTempDataProperty(key));
62-
63-
Assert.That(exception.Message, Is.EqualTo(string.Format(
64-
"Expected TempData to have a non-null value with key \"{0}\", but none found.", key)));
65-
}
66-
67-
[Test]
61+
_controller.ShouldHaveTempDataProperty(key));
62+
63+
Assert.That(exception.Message, Is.EqualTo(string.Format(
64+
"Expected TempData to have a non-null value with key '{0}', but none found.", key)));
65+
}
66+
67+
[Test]
6868
public void Check_for_existent_temp_data_property_and_check_value()
6969
{
7070
const string key = "";
@@ -82,13 +82,13 @@ public void Check_for_existent_temp_data_property_and_check_invalid_value()
8282
const int expectedValue = 1;
8383
_controller.TempData[key] = actualValue;
8484

85-
var exception = Assert.Throws<TempDataAssertionException>(() =>
86-
_controller.ShouldHaveTempDataProperty(key, expectedValue));
87-
88-
Assert.That(exception.Message, Is.EqualTo(string.Format("Expected value for key \"{0}\" to be \"{1}\", but instead found \"{2}\"", key, expectedValue, actualValue)));
89-
}
90-
91-
[Test]
85+
var exception = Assert.Throws<TempDataAssertionException>(() =>
86+
_controller.ShouldHaveTempDataProperty(key, expectedValue));
87+
88+
Assert.That(exception.Message, Is.EqualTo(string.Format("Expected value for key '{0}' to be '{1}', but instead found '{2}'", key, expectedValue, actualValue)));
89+
}
90+
91+
[Test]
9292
public void Check_for_existent_temp_data_property_and_check_invalid_value_of_different_types()
9393
{
9494
const string key = "";
@@ -141,13 +141,13 @@ public void Check_for_unexpected_non_existent_temp_data_property_when_supplied_w
141141
const string key = "";
142142

143143
var exception = Assert.Throws<TempDataAssertionException>(() =>
144-
_controller.ShouldHaveTempDataProperty<int>(key, x => x == 0));
145-
146-
Assert.That(exception.Message, Is.EqualTo(string.Format(
147-
"Expected TempData to have a non-null value with key \"{0}\", but none found.", key)));
148-
}
149-
150-
[Test]
144+
_controller.ShouldHaveTempDataProperty<int>(key, x => x == 0));
145+
146+
Assert.That(exception.Message, Is.EqualTo(string.Format(
147+
"Expected TempData to have a non-null value with key '{0}', but none found.", key)));
148+
}
149+
150+
[Test]
151151
public void Check_for_non_existent_temp_data_property()
152152
{
153153
_controller
@@ -161,10 +161,10 @@ public void Check_for_unexpected_existent_temp_data_property()
161161
_controller.TempData[Key] = "";
162162

163163
var exception = Assert.Throws<TempDataAssertionException>(() =>
164-
_controller.ShouldNotHaveTempDataProperty(Key));
165-
166-
Assert.That(exception.Message, Is.EqualTo(string.Format(
167-
"Expected TempData to have no value with key \"{0}\", but found one.", Key)));
168-
}
169-
}
170-
}
164+
_controller.ShouldNotHaveTempDataProperty(Key));
165+
166+
Assert.That(exception.Message, Is.EqualTo(string.Format(
167+
"Expected TempData to have no value with key '{0}', but found one.", Key)));
168+
}
169+
}
170+
}

TestStack.FluentMVCTesting.Tests/ControllerResultTestTests/ShouldRenderFileTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public void Check_for_file_content_result_and_check_invalid_textual_contents()
104104
var exception = Assert.Throws<ActionResultAssertionException>(() =>
105105
_controller.WithCallTo(c => c.TextualFile()).ShouldRenderFileContents(contents));
106106

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

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

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

315315
[Test]

TestStack.FluentMVCTesting.Tests/ControllerResultTestTests/ShouldReturnContentTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void Check_for_content_result_and_check_invalid_content()
2626

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

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

3232
[Test]
@@ -42,7 +42,7 @@ public void Check_for_content_result_and_check_content_and_check_invalid_content
4242

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

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

4848
[Test]

TestStack.FluentMVCTesting.Tests/TempDataResultTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void Check_for_unexpected_non_existent_temp_data_property()
3535
_tempDataTest.AndShouldHaveTempDataProperty(key));
3636

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

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

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

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

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

123123
[Test]
@@ -137,7 +137,7 @@ public void Check_for_unexpected_existent_temp_data_property()
137137
_tempDataTest.AndShouldNotHaveTempDataProperty(Key));
138138

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

143143
[Test]

TestStack.FluentMvcTesting/ControllerExtensions.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -64,40 +64,40 @@ public static TempDataResultTest ShouldHaveTempDataProperty(this ControllerBase
6464
{
6565
var actual = controller.TempData[key];
6666

67-
if (actual == null)
68-
{
69-
throw new TempDataAssertionException(string.Format(
70-
"Expected TempData to have a non-null value with key \"{0}\", but none found.", key));
71-
}
72-
73-
if (value != null && actual.GetType() != value.GetType())
67+
if (actual == null)
68+
{
69+
throw new TempDataAssertionException(string.Format(
70+
"Expected TempData to have a non-null value with key '{0}', but none found.", key));
71+
}
72+
73+
if (value != null && actual.GetType() != value.GetType())
7474
{
7575
throw new TempDataAssertionException(string.Format(
7676
"Expected value to be of type {0}, but instead was {1}.",
7777
value.GetType().FullName,
7878
actual.GetType().FullName));
7979
}
8080

81-
if (value != null && !value.Equals(actual))
82-
{
83-
throw new TempDataAssertionException(string.Format(
84-
"Expected value for key \"{0}\" to be \"{1}\", but instead found \"{2}\"", key, value, actual));
85-
}
86-
87-
return new TempDataResultTest(controller);
81+
if (value != null && !value.Equals(actual))
82+
{
83+
throw new TempDataAssertionException(string.Format(
84+
"Expected value for key '{0}' to be '{1}', but instead found '{2}'", key, value, actual));
85+
}
86+
87+
return new TempDataResultTest(controller);
8888
}
8989

9090
public static TempDataResultTest ShouldHaveTempDataProperty<TValue>(this ControllerBase controller, string key, Func<TValue, bool> predicate)
9191
{
9292
var actual = controller.TempData[key];
9393

94-
if (actual == null)
95-
{
96-
throw new TempDataAssertionException(string.Format(
97-
"Expected TempData to have a non-null value with key \"{0}\", but none found.", key));
98-
}
99-
100-
if (!predicate((TValue)actual))
94+
if (actual == null)
95+
{
96+
throw new TempDataAssertionException(string.Format(
97+
"Expected TempData to have a non-null value with key '{0}', but none found.", key));
98+
}
99+
100+
if (!predicate((TValue)actual))
101101
{
102102
throw new TempDataAssertionException("Expected view model to pass the given condition, but it failed.");
103103
}
@@ -109,13 +109,13 @@ public static TempDataResultTest ShouldNotHaveTempDataProperty(this ControllerBa
109109
{
110110
var actual = controller.TempData[key];
111111

112-
if (actual != null)
113-
{
114-
throw new TempDataAssertionException(string.Format(
115-
"Expected TempData to have no value with key \"{0}\", but found one.", key));
116-
}
117-
118-
return new TempDataResultTest(controller);
112+
if (actual != null)
113+
{
114+
throw new TempDataAssertionException(string.Format(
115+
"Expected TempData to have no value with key '{0}', but found one.", key));
116+
}
117+
118+
return new TempDataResultTest(controller);
119119
}
120120

121121
}

TestStack.FluentMvcTesting/ControllerResultTest/ShouldRenderFile.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public FileContentResult ShouldRenderFileContents(string contents, string conten
6969
if (contents != reconstitutedText)
7070
{
7171
throw new ActionResultAssertionException(string.Format(
72-
"Expected file contents to be \"{0}\", but instead was \"{1}\".",
72+
"Expected file contents to be '{0}', but instead was '{1}'.",
7373
contents,
7474
reconstitutedText));
7575
}
@@ -121,7 +121,7 @@ public FileStreamResult ShouldRenderFileStream(string contents, string contentTy
121121
if (contents != reconstitutedText)
122122
{
123123
throw new ActionResultAssertionException(string.Format(
124-
"Expected file contents to be \"{0}\", but instead was \"{1}\".",
124+
"Expected file contents to be '{0}', but instead was '{1}'.",
125125
contents,
126126
reconstitutedText));
127127
}

TestStack.FluentMvcTesting/ControllerResultTest/ShouldReturnContent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ public ContentResult ShouldReturnContent(string content = null, string contentTy
1313
if (contentType != null && contentType != contentResult.ContentType)
1414
{
1515
throw new ActionResultAssertionException(string.Format(
16-
"Expected content type to be \"{0}\", but instead was \"{1}\".",
16+
"Expected content type to be '{0}', but instead was '{1}'.",
1717
contentType,
1818
contentResult.ContentType));
1919
}
2020

2121
if (content != null && content != contentResult.Content)
2222
{
2323
throw new ActionResultAssertionException(string.Format(
24-
"Expected content to be \"{0}\", but instead was \"{1}\".",
24+
"Expected content to be '{0}', but instead was '{1}'.",
2525
content,
2626
contentResult.Content));
2727
}

0 commit comments

Comments
 (0)