Skip to content

Commit b5edc1d

Browse files
committed
Upgraded Fluent Assertions to v2.1 and fixed breaking changed where Execute.Verification property was renamed to Execute.Assertion.
1 parent 11e383f commit b5edc1d

17 files changed

+56
-46
lines changed

samples/FluentAssertions.Mvc3.Samples/FluentAssertions.Mvc3.Samples.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949
<Reference Include="EntityFramework">
5050
<HintPath>..\..\packages\EntityFramework.4.1.10331.0\lib\EntityFramework.dll</HintPath>
5151
</Reference>
52-
<Reference Include="FluentAssertions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
52+
<Reference Include="FluentAssertions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
5353
<SpecificVersion>False</SpecificVersion>
54-
<HintPath>..\..\packages\FluentAssertions.2.0.0.1\lib\net40\FluentAssertions.dll</HintPath>
54+
<HintPath>..\..\packages\FluentAssertions.2.1.0.0\lib\net40\FluentAssertions.dll</HintPath>
5555
</Reference>
5656
<Reference Include="nunit.framework, Version=2.6.0.12051, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
5757
<SpecificVersion>False</SpecificVersion>

samples/FluentAssertions.Mvc3.Samples/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="EntityFramework" version="4.1.10331.0" />
4-
<package id="FluentAssertions" version="2.0.0.1" targetFramework="net40" />
4+
<package id="FluentAssertions" version="2.1.0.0" targetFramework="net40" />
55
<package id="jQuery" version="1.5.1" />
66
<package id="jQuery.UI.Combined" version="1.8.11" />
77
<package id="jQuery.Validation" version="1.8.0" />

src/FluentAssertions.Mvc3/ActionResultAssertions.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public ContentResultAssertions BeContentResult()
2626

2727
public ContentResultAssertions BeContentResult(string reason, params object[] reasonArgs)
2828
{
29-
Execute.Verification
29+
Execute.Assertion
3030
.BecauseOf(reason, reasonArgs)
3131
.ForCondition(Subject is ContentResult)
3232
.FailWith(Constants.CommonFailMessage, typeof(ContentResult).Name, Subject.GetType().Name);
@@ -41,7 +41,7 @@ public EmptyResult BeEmptyResult()
4141

4242
public EmptyResult BeEmptyResult(string reason, params object[] reasonArgs)
4343
{
44-
Execute.Verification
44+
Execute.Assertion
4545
.BecauseOf(reason, reasonArgs)
4646
.ForCondition(Subject is EmptyResult)
4747
.FailWith(Constants.CommonFailMessage, typeof(EmptyResult).Name, Subject.GetType().Name);
@@ -56,7 +56,7 @@ public RedirectToRouteAssertions BeRedirectToRouteResult()
5656

5757
public RedirectToRouteAssertions BeRedirectToRouteResult(string reason, params object[] reasonArgs)
5858
{
59-
Execute.Verification
59+
Execute.Assertion
6060
.BecauseOf(reason, reasonArgs)
6161
.ForCondition(Subject is RedirectToRouteResult)
6262
.FailWith(Constants.CommonFailMessage, typeof(RedirectToRouteResult).Name, Subject.GetType().Name);
@@ -71,7 +71,7 @@ public PartialViewResultAssertions BePartialViewResult()
7171

7272
public PartialViewResultAssertions BePartialViewResult(string reason, params object[] reasonArgs)
7373
{
74-
Execute.Verification
74+
Execute.Assertion
7575
.BecauseOf(reason, reasonArgs)
7676
.ForCondition(Subject is PartialViewResult)
7777
.FailWith(Constants.CommonFailMessage, typeof(PartialViewResult).Name, Subject.GetType().Name);
@@ -86,7 +86,7 @@ public RedirectResultAssertions BeRedirectResult()
8686

8787
public RedirectResultAssertions BeRedirectResult(string reason, params object[] reasonArgs)
8888
{
89-
Execute.Verification
89+
Execute.Assertion
9090
.BecauseOf(reason, reasonArgs)
9191
.ForCondition(Subject is RedirectResult)
9292
.FailWith(Constants.CommonFailMessage, "RedirectResult", Subject.GetType().Name);
@@ -101,7 +101,7 @@ public ViewResultAssertions BeViewResult()
101101

102102
public ViewResultAssertions BeViewResult(string reason, params object[] reasonArgs)
103103
{
104-
Execute.Verification
104+
Execute.Assertion
105105
.BecauseOf(reason, reasonArgs)
106106
.ForCondition (Subject is ViewResult)
107107
.FailWith(Constants.CommonFailMessage, "ViewResult", Subject.GetType().Name);

src/FluentAssertions.Mvc3/ContentResultAssertions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public ContentResultAssertions WithContent(string expectedContent, string reason
2424
{
2525
string actualContent = (Subject as ContentResult).Content;
2626

27-
Execute.Verification
27+
Execute.Assertion
2828
.ForCondition(string.Equals(actualContent, expectedContent, StringComparison.InvariantCultureIgnoreCase))
2929
.BecauseOf(reason, reasonArgs)
3030
.FailWith(string.Format(FailureMessages.CommonFailMessage, "ContentResult.Content", expectedContent, actualContent));
@@ -42,7 +42,7 @@ public ContentResultAssertions WithContentType(string expectedContent, string re
4242
{
4343
string actualContentType = (Subject as ContentResult).ContentType;
4444

45-
Execute.Verification
45+
Execute.Assertion
4646
.ForCondition(string.Equals(expectedContent, actualContentType, StringComparison.InvariantCultureIgnoreCase))
4747
.BecauseOf(reason, reasonArgs)
4848
.FailWith(string.Format(FailureMessages.CommonFailMessage, "ContentResult.ContentType", expectedContent, actualContentType));
@@ -60,7 +60,7 @@ public ContentResultAssertions WithContentEncoding(Encoding expectedEncoding, st
6060
{
6161
Encoding actualContentEncoding = (Subject as ContentResult).ContentEncoding;
6262

63-
Execute.Verification
63+
Execute.Assertion
6464
.ForCondition(expectedEncoding == actualContentEncoding)
6565
.BecauseOf(reason, reasonArgs)
6666
.FailWith(string.Format(FailureMessages.CommonFailMessage, "ContentResult.ContentType", expectedEncoding.ToString(), actualContentEncoding.ToString()));

src/FluentAssertions.Mvc3/FluentAssertions.Mvc3.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
<DocumentationFile>..\..\bin\Release\FluentAssertions.Mvc3.XML</DocumentationFile>
4545
</PropertyGroup>
4646
<ItemGroup>
47-
<Reference Include="FluentAssertions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
47+
<Reference Include="FluentAssertions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
4848
<SpecificVersion>False</SpecificVersion>
49-
<HintPath>..\..\packages\FluentAssertions.2.0.0.1\lib\net40\FluentAssertions.dll</HintPath>
49+
<HintPath>..\..\packages\FluentAssertions.2.1.0.0\lib\net40\FluentAssertions.dll</HintPath>
5050
</Reference>
5151
<Reference Include="System" />
5252
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
@@ -83,15 +83,15 @@
8383
<Compile Include="ViewResultAssertions.cs" />
8484
<Compile Include="ViewResultBaseAssertions.cs" />
8585
</ItemGroup>
86-
<ItemGroup>
87-
<None Include="packages.config" />
88-
</ItemGroup>
8986
<ItemGroup>
9087
<EmbeddedResource Include="FailureMessages.resx">
9188
<Generator>ResXFileCodeGenerator</Generator>
9289
<LastGenOutput>FailureMessages.Designer.cs</LastGenOutput>
9390
</EmbeddedResource>
9491
</ItemGroup>
92+
<ItemGroup>
93+
<None Include="packages.config" />
94+
</ItemGroup>
9595
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
9696
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
9797
</Project>

src/FluentAssertions.Mvc3/RedirectResultAssertions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public RedirectResultAssertions WithUrl(string expectedUrl, string reason, strin
2222
{
2323
string actualUrl = (Subject as RedirectResult).Url;
2424

25-
Execute.Verification
25+
Execute.Assertion
2626
.ForCondition(string.Equals(actualUrl, expectedUrl, StringComparison.InvariantCultureIgnoreCase))
2727
.BecauseOf(reason, reasonArgs)
2828
.FailWith("Expected RedirectResult.Url to be {0}{reason} but was {1}", expectedUrl, actualUrl);
@@ -40,7 +40,7 @@ public RedirectResultAssertions WithPermanent(bool expectedPermanent, string rea
4040
{
4141
bool actualPermanent = (Subject as RedirectResult).Permanent;
4242

43-
Execute.Verification
43+
Execute.Assertion
4444
.ForCondition(expectedPermanent == actualPermanent)
4545
.BecauseOf(reason, reasonArgs)
4646
.FailWith("Expected RedirectResult.Permanent to be {0}{reason} but was {1}", expectedPermanent, actualPermanent);

src/FluentAssertions.Mvc3/RedirectToRouteAssertions.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public RedirectToRouteAssertions WithPermanent(bool expectedPermanent)
2424

2525
public RedirectToRouteAssertions WithPermanent(bool expectedPermanent, string reason, params object[] reasonArgs)
2626
{
27-
Execute.Verification
27+
Execute.Assertion
2828
.BecauseOf(reason, reasonArgs)
2929
.ForCondition(expectedPermanent == Subject.Permanent)
3030
.FailWith("Expected RedirectToRoute.Permanent to be {0}{reason}, but found {1}", expectedPermanent, Subject.Permanent);
@@ -39,7 +39,7 @@ public RedirectToRouteAssertions WithRouteName(string expectedRouteName)
3939

4040
public RedirectToRouteAssertions WithRouteName(string expectedRouteName, string reason, params object[] reasonArgs)
4141
{
42-
Execute.Verification
42+
Execute.Assertion
4343
.BecauseOf(reason, reasonArgs)
4444
.ForCondition(string.Equals(expectedRouteName, Subject.RouteName, StringComparison.InvariantCultureIgnoreCase))
4545
.FailWith("Expected RedirectToRoute.RouteName to be {0}{reason}, but found {1}", expectedRouteName, Subject.RouteName);
@@ -94,5 +94,13 @@ public RedirectToRouteAssertions WithArea(string expectedArea, string reason, pa
9494
WithRouteValue("Area", expectedArea, reason, reasonArgs);
9595
return this;
9696
}
97+
98+
/// <summary>
99+
/// Returns the type of the subject the assertion applies on.
100+
/// </summary>
101+
protected override string Context
102+
{
103+
get { return "RedirectToRouteResult"; }
104+
}
97105
}
98106
}

src/FluentAssertions.Mvc3/RouteDataAssertions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ public RouteDataAssertions HaveDataToken(string key, object expectedValue, strin
5353
{
5454
var subjectTyped = Subject as RouteData;
5555

56-
Execute.Verification
56+
Execute.Assertion
5757
.ForCondition(subjectTyped.DataTokens.ContainsKey(key))
5858
.BecauseOf(reason, reasonArgs)
5959
.FailWith(FailureMessages.RouteData_DataTokens_ContainsKey, key);
6060

6161
var actualValue = subjectTyped.DataTokens[key];
6262

63-
Execute.Verification
63+
Execute.Assertion
6464
.ForCondition(expectedValue.Equals(actualValue))
6565
.BecauseOf(reason, reasonArgs)
6666
.FailWith(FailureMessages.RouteData_DataTokens_HaveValue, key, expectedValue, actualValue);
@@ -78,14 +78,14 @@ public RouteDataAssertions HaveValue(string key, object expectedValue, string re
7878
{
7979
var subjectTyped = Subject as RouteData;
8080

81-
Execute.Verification
81+
Execute.Assertion
8282
.ForCondition(subjectTyped.Values.ContainsKey(key))
8383
.BecauseOf(reason, reasonArgs)
8484
.FailWith(FailureMessages.RouteData_Values_ContainsKey, key);
8585

8686
var actualValue = subjectTyped.Values[key];
8787

88-
Execute.Verification
88+
Execute.Assertion
8989
.ForCondition(expectedValue.Equals(actualValue))
9090
.BecauseOf(reason, reasonArgs)
9191
.FailWith(FailureMessages.RouteData_Values_HaveValue, key, expectedValue, actualValue);

src/FluentAssertions.Mvc3/ViewResultAssertions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public ViewResultAssertions WithMasterName(string expectedMasterName, string rea
2020
{
2121
string actualMasterName = (Subject as ViewResult).MasterName;
2222

23-
Execute.Verification
23+
Execute.Assertion
2424
.ForCondition(string.Equals(expectedMasterName, actualMasterName, StringComparison.InvariantCultureIgnoreCase))
2525
.BecauseOf(reason, reasonArgs)
2626
.FailWith(FailureMessages.ViewResult_MasterName, expectedMasterName, actualMasterName);

src/FluentAssertions.Mvc3/ViewResultBaseAssertions.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public ViewResultBaseAssertions<T> WithViewName(string expectedViewName, string
2828
{
2929
string actualViewName = (Subject as ViewResultBase).ViewName;
3030

31-
Execute.Verification
31+
Execute.Assertion
3232
.ForCondition(string.Equals(expectedViewName, actualViewName, StringComparison.InvariantCultureIgnoreCase))
3333
.BecauseOf(reason, reasonArgs)
3434
.FailWith(FailureMessages.ViewResultBase_ViewName, expectedViewName, actualViewName);
@@ -45,14 +45,14 @@ public ViewResultBaseAssertions<T> WithViewData(string key, object expectedValue
4545
{
4646
ViewDataDictionary actualViewData = (Subject as ViewResultBase).ViewData;
4747

48-
Execute.Verification
48+
Execute.Assertion
4949
.ForCondition(actualViewData.ContainsKey(key))
5050
.BecauseOf(reason, reasonArgs)
5151
.FailWith(FailureMessages.ViewResultBase_ViewData_ContainsKey, key);
5252

5353
var actualValue = actualViewData[key];
5454

55-
Execute.Verification
55+
Execute.Assertion
5656
.ForCondition(actualValue.Equals(expectedValue))
5757
.BecauseOf(reason, reasonArgs)
5858
.FailWith(FailureMessages.ViewResultBase_ViewData_HaveValue, key, expectedValue, actualValue);
@@ -70,7 +70,7 @@ public ViewResultBaseAssertions<T> WithTempData(string key, object expectedValue
7070
{
7171
TempDataDictionary actualTempData = (Subject as ViewResultBase).TempData;
7272

73-
Execute.Verification
73+
Execute.Assertion
7474
.ForCondition(actualTempData.ContainsKey(key))
7575
.BecauseOf(reason, reasonArgs)
7676
.FailWith("TempData does not contain key of '{0}'", key);
@@ -94,9 +94,9 @@ public TModel ModelAs<TModel>()
9494
object model = (Subject as ViewResultBase).Model;
9595

9696
if (model == null)
97-
Execute.Verification.FailWith(FailureMessages.ViewResultBase_NullModel, typeof(TModel).Name);
97+
Execute.Assertion.FailWith(FailureMessages.ViewResultBase_NullModel, typeof(TModel).Name);
9898

99-
Execute.Verification
99+
Execute.Assertion
100100
.ForCondition(model is TModel)
101101
.FailWith("Expected Model to be of type '{0}' but was '{1}'", typeof(TModel).Name, model.GetType().Name);
102102

@@ -113,7 +113,7 @@ public ViewResultBaseAssertions<T> WithDefaultViewName(string reason, params obj
113113
{
114114
string viewName = (Subject as ViewResultBase).ViewName;
115115

116-
Execute.Verification
116+
Execute.Assertion
117117
.ForCondition(viewName == string.Empty)
118118
.BecauseOf(reason, reasonArgs)
119119
.FailWith(FailureMessages.ViewResultBase_WithDefaultViewName, viewName);

0 commit comments

Comments
 (0)