Skip to content

Commit 5cc6e1b

Browse files
committed
ContainsContentTypes -> WithContentTypes
1 parent f9348d5 commit 5cc6e1b

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

src/FluentAssertions.AspNetCore.Mvc/ObjectResultAssertionsBase.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public TObjectResultAssertion ContainsFormatter(Expression<Func<IOutputFormatter
120120
/// <param name="reasonArgs">
121121
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
122122
/// </param>
123-
public TObjectResultAssertion ContainsContentType(string expected, string reason = "", params object[] reasonArgs)
123+
public TObjectResultAssertion WithContentType(string expected, string reason = "", params object[] reasonArgs)
124124
{
125125
var formatters = ObjectResultSubject.ContentTypes;
126126

tests/FluentAssertions.AspNetCore.Mvc.Tests/ObjectResultAssertions_Tests.cs

+6-11
Original file line numberDiff line numberDiff line change
@@ -105,26 +105,21 @@ public void ContainsFormatter_GivenUnexpected_ShouldFail()
105105
.WithMessage(failureMessage);
106106
}
107107

108-
109-
110-
111-
112-
113108
[Fact]
114-
public void ContainsContentType_GivenExpected_ShouldPass()
109+
public void WithContentType_GivenExpected_ShouldPass()
115110
{
116111
var mediaType = "text/html";
117112
var result = new ObjectResult(TestValue)
118113
{
119114
ContentTypes = { mediaType }
120115
};
121116

122-
result.Should().BeObjectResult().ContainsContentType(mediaType);
117+
result.Should().BeObjectResult().WithContentType(mediaType);
123118
}
124119
#if NETCOREAPP2_1
125120
// In NetCore3.1 ContentTypes cant be null.
126121
[Fact]
127-
public void ContainsContentType_OnNullMediaType_ShouldFail()
122+
public void WithContentType_OnNullMediaType_ShouldFail()
128123
{
129124
var expected = "text/json";
130125
var result = new ObjectResult(TestValue)
@@ -135,14 +130,14 @@ public void ContainsContentType_OnNullMediaType_ShouldFail()
135130
"ObjectResult.ContentTypes",
136131
expected);
137132

138-
Action a = () => result.Should().BeObjectResult().ContainsContentType(expected, Reason, ReasonArgs);
133+
Action a = () => result.Should().BeObjectResult().WithContentType(expected, Reason, ReasonArgs);
139134

140135
a.Should().Throw<Exception>()
141136
.WithMessage(failureMessage);
142137
}
143138
#endif
144139
[Fact]
145-
public void ContainsContentType_GivenUnexpected_ShouldFail()
140+
public void WithContentType_GivenUnexpected_ShouldFail()
146141
{
147142
var mediaType = "text/html";
148143
var expected = "text/json";
@@ -155,7 +150,7 @@ public void ContainsContentType_GivenUnexpected_ShouldFail()
155150
result.ContentTypes,
156151
expected);
157152

158-
Action a = () => result.Should().BeObjectResult().ContainsContentType(expected, Reason, ReasonArgs);
153+
Action a = () => result.Should().BeObjectResult().WithContentType(expected, Reason, ReasonArgs);
159154

160155
a.Should().Throw<Exception>()
161156
.WithMessage(failureMessage);

0 commit comments

Comments
 (0)