Skip to content
Merged
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ TestResult.xml
[Tt]est[Rr]esults/
*.gpState
[Pp]ackages/
*.nupkg
*.nupkg
/.vs
53 changes: 29 additions & 24 deletions FluentAssertionsMvc.sln
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mvc3", "Mvc3", "{4E91D524-3DC0-4E08-82FE-6FDAEB89212B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mvc4", "Mvc4", "{34E084BA-3DFA-4042-9B30-5C14831901B4}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{4E91D524-3DC0-4E08-82FE-6FDAEB89212B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "nuspecs", "nuspecs", "{48A7D304-F178-46B0-901E-E060D87B5E07}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -25,21 +23,35 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentAssertions.Mvc3", "sr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentAssertions.Mvc3.Tests", "tests\FluentAssertions.Mvc3.Tests\FluentAssertions.Mvc3.Tests.csproj", "{3CB00FF9-3DC2-460F-82E8-EBFB6339247D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "tests\test\test.csproj", "{D29AE253-FEE8-4A54-BFBD-323CAD27F549}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentAssertions.Mvc3.Samples", "samples\FluentAssertions.Mvc3.Samples\FluentAssertions.Mvc3.Samples.csproj", "{95B0CEBD-D9B8-4C41-A918-B13317A9AC16}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentAssertions.Mvc4", "src\FluentAssertions.Mvc4\FluentAssertions.Mvc4.csproj", "{B18BFBDE-02A0-4DB2-AFEA-E756C177E4AD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentAssertions.Mvc4.Tests", "tests\FluentAssertions.Mvc4.Tests\FluentAssertions.Mvc4.Tests.csproj", "{B9F72C07-90A8-4A15-815B-7618530CA889}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mvc5", "Mvc5", "{466CDF89-8C39-4734-9644-CE16B787EDD1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentAssertions.Mvc5", "src\FluentAssertions.Mvc5\FluentAssertions.Mvc5.csproj", "{E5BFF617-46A3-48F7-83AA-BD34376F1AB2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentAssertions.Mvc5.Tests", "tests\FluentAssertions.Mvc5.Tests\FluentAssertions.Mvc5.Tests.csproj", "{650A92FF-8874-41CD-BCDA-BE583F3F2638}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{89B09C65-4F1E-4B5A-AD58-E244113F2C02}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "FluentAssertions.Mvc.Shared", "src\FluentAssertions.Mvc.Shared\FluentAssertions.Mvc.Shared.shproj", "{0E46FC22-EB6A-431E-BFB3-47FBC4FC500F}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "FluentAssertions.Mvc.Tests.Shared", "tests\FluentAssertions.Mvc.Tests.Shared\FluentAssertions.Mvc.Tests.Shared.shproj", "{AEEA0A6D-F5B6-42DB-9AF0-82164ECCA21B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{A4C33565-1E6E-4AE7-8F02-1911DBA00263}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\FluentAssertions.Mvc.Shared\FluentAssertions.Mvc.Shared.projitems*{0e46fc22-eb6a-431e-bfb3-47fbc4fc500f}*SharedItemsImports = 13
tests\FluentAssertions.Mvc.Tests.Shared\FluentAssertions.Mvc.Tests.Shared.projitems*{aeea0a6d-f5b6-42db-9af0-82164ecca21b}*SharedItemsImports = 13
tests\FluentAssertions.Mvc.Tests.Shared\FluentAssertions.Mvc.Tests.Shared.projitems*{3cb00ff9-3dc2-460f-82e8-ebfb6339247d}*SharedItemsImports = 4
src\FluentAssertions.Mvc.Shared\FluentAssertions.Mvc.Shared.projitems*{e5bff617-46a3-48f7-83aa-bd34376f1ab2}*SharedItemsImports = 4
tests\FluentAssertions.Mvc.Tests.Shared\FluentAssertions.Mvc.Tests.Shared.projitems*{650a92ff-8874-41cd-bcda-be583f3f2638}*SharedItemsImports = 4
src\FluentAssertions.Mvc.Shared\FluentAssertions.Mvc.Shared.projitems*{b18bfbde-02a0-4db2-afea-e756c177e4ad}*SharedItemsImports = 4
tests\FluentAssertions.Mvc.Tests.Shared\FluentAssertions.Mvc.Tests.Shared.projitems*{b9f72c07-90a8-4a15-815b-7618530ca889}*SharedItemsImports = 4
src\FluentAssertions.Mvc.Shared\FluentAssertions.Mvc.Shared.projitems*{53589f79-0908-409a-8366-3e18dc637600}*SharedItemsImports = 4
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Expand Down Expand Up @@ -67,15 +79,6 @@ Global
{3CB00FF9-3DC2-460F-82E8-EBFB6339247D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{3CB00FF9-3DC2-460F-82E8-EBFB6339247D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{3CB00FF9-3DC2-460F-82E8-EBFB6339247D}.Release|x86.ActiveCfg = Release|Any CPU
{D29AE253-FEE8-4A54-BFBD-323CAD27F549}.Debug|Any CPU.ActiveCfg = Debug|x86
{D29AE253-FEE8-4A54-BFBD-323CAD27F549}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{D29AE253-FEE8-4A54-BFBD-323CAD27F549}.Debug|Mixed Platforms.Build.0 = Debug|x86
{D29AE253-FEE8-4A54-BFBD-323CAD27F549}.Debug|x86.ActiveCfg = Debug|x86
{D29AE253-FEE8-4A54-BFBD-323CAD27F549}.Debug|x86.Build.0 = Debug|x86
{D29AE253-FEE8-4A54-BFBD-323CAD27F549}.Release|Any CPU.ActiveCfg = Release|x86
{D29AE253-FEE8-4A54-BFBD-323CAD27F549}.Release|Mixed Platforms.ActiveCfg = Release|x86
{D29AE253-FEE8-4A54-BFBD-323CAD27F549}.Release|x86.ActiveCfg = Release|x86
{D29AE253-FEE8-4A54-BFBD-323CAD27F549}.Release|x86.Build.0 = Release|x86
{95B0CEBD-D9B8-4C41-A918-B13317A9AC16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{95B0CEBD-D9B8-4C41-A918-B13317A9AC16}.Debug|Any CPU.Build.0 = Debug|Any CPU
{95B0CEBD-D9B8-4C41-A918-B13317A9AC16}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -131,12 +134,14 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{53589F79-0908-409A-8366-3E18DC637600} = {4E91D524-3DC0-4E08-82FE-6FDAEB89212B}
{3CB00FF9-3DC2-460F-82E8-EBFB6339247D} = {4E91D524-3DC0-4E08-82FE-6FDAEB89212B}
{53589F79-0908-409A-8366-3E18DC637600} = {89B09C65-4F1E-4B5A-AD58-E244113F2C02}
{3CB00FF9-3DC2-460F-82E8-EBFB6339247D} = {A4C33565-1E6E-4AE7-8F02-1911DBA00263}
{95B0CEBD-D9B8-4C41-A918-B13317A9AC16} = {4E91D524-3DC0-4E08-82FE-6FDAEB89212B}
{B18BFBDE-02A0-4DB2-AFEA-E756C177E4AD} = {34E084BA-3DFA-4042-9B30-5C14831901B4}
{B9F72C07-90A8-4A15-815B-7618530CA889} = {34E084BA-3DFA-4042-9B30-5C14831901B4}
{E5BFF617-46A3-48F7-83AA-BD34376F1AB2} = {466CDF89-8C39-4734-9644-CE16B787EDD1}
{650A92FF-8874-41CD-BCDA-BE583F3F2638} = {466CDF89-8C39-4734-9644-CE16B787EDD1}
{B18BFBDE-02A0-4DB2-AFEA-E756C177E4AD} = {89B09C65-4F1E-4B5A-AD58-E244113F2C02}
{B9F72C07-90A8-4A15-815B-7618530CA889} = {A4C33565-1E6E-4AE7-8F02-1911DBA00263}
{E5BFF617-46A3-48F7-83AA-BD34376F1AB2} = {89B09C65-4F1E-4B5A-AD58-E244113F2C02}
{650A92FF-8874-41CD-BCDA-BE583F3F2638} = {A4C33565-1E6E-4AE7-8F02-1911DBA00263}
{0E46FC22-EB6A-431E-BFB3-47FBC4FC500F} = {89B09C65-4F1E-4B5A-AD58-E244113F2C02}
{AEEA0A6D-F5B6-42DB-9AF0-82164ECCA21B} = {A4C33565-1E6E-4AE7-8F02-1911DBA00263}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<IISExpressUseClassicPipelineMode />
<MvcProjectUpgradeChecked>true</MvcProjectUpgradeChecked>
<TargetFrameworkProfile />
<UseGlobalApplicationHostFile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -65,9 +66,9 @@
<HintPath>..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
<Reference Include="nunit.framework, Version=3.2.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUnit.3.2.1\lib\net40\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data.Entity" />
Expand Down
2 changes: 1 addition & 1 deletion samples/FluentAssertions.Mvc3.Samples/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
<package id="Microsoft.AspNet.WebPages" version="1.0.20105.408" targetFramework="net40" allowedVersions="(,2)" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net40" />
<package id="Modernizr" version="1.7" />
<package id="NUnit" version="2.6.3" targetFramework="net40" />
<package id="NUnit" version="3.2.1" targetFramework="net40" />
</packages>
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
using FluentAssertions;
using System;
using System.Web.Mvc;
using FluentAssertions.Mvc;
using System.Web.Routing;
using System.Diagnostics;
namespace FluentAssertions.Mvc
{
/// <summary>
/// Contains extension methods for custom assertions in unit tests.
/// </summary>
[DebuggerNonUserCode]
public static class AssertionsExtensions
{
/// <summary>
/// Returns an <see cref="ActionResultAssertions"/> object that can be used to assert the
/// current <see cref="ActionResult"/>.
/// </summary>
public static ActionResultAssertions Should (this ActionResult actual)
{
return new ActionResultAssertions (actual);
}
/// <summary>
/// Returns an <see cref="RouteDataAssertions"/> object that can be used to assert the
/// current <see cref="RouteData"/>.
/// </summary>
public static RouteDataAssertions Should(this RouteData routeData)
{
return new RouteDataAssertions(routeData);
}
}
}
using FluentAssertions;
using System;
using System.Web.Mvc;
using FluentAssertions.Mvc;
using System.Web.Routing;
using System.Diagnostics;

namespace FluentAssertions.Mvc
{
/// <summary>
/// Contains extension methods for custom assertions in unit tests.
/// </summary>
[DebuggerNonUserCode]
public static class AssertionsExtensions
{
/// <summary>
/// Returns an <see cref="ActionResultAssertions"/> object that can be used to assert the
/// current <see cref="ActionResult"/>.
/// </summary>
public static ActionResultAssertions Should (this ActionResult actual)
{
return new ActionResultAssertions (actual);
}

/// <summary>
/// Returns an <see cref="RouteDataAssertions"/> object that can be used to assert the
/// current <see cref="RouteData"/>.
/// </summary>
public static RouteDataAssertions Should(this RouteData routeData)
{
return new RouteDataAssertions(routeData);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System;
using System.Diagnostics;
namespace FluentAssertions.Mvc
{
[DebuggerNonUserCode]
public class ControllerAssertions
{
public ControllerAssertions ()
{
}
}
}
using System;
using System.Diagnostics;

namespace FluentAssertions.Mvc
{
[DebuggerNonUserCode]
public class ControllerAssertions
{
public ControllerAssertions ()
{
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>0e46fc22-eb6a-431e-bfb3-47fbc4fc500f</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>FluentAssertions.Mvc.Shared</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)FailureMessages.resx">
<Generator>ResXFileCodeGenerator</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)ActionResultAssertions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)AssertionsExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ContentResultAssertions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ControllerAssertions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FailureMessages.Designer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Fakes\FakeHttpContext.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Fakes\FakeHttpRequest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Fakes\FakeHttpResponse.cs" />
<Compile Include="$(MSBuildThisFileDirectory)PartialViewResultAssertions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RedirectResultAssertions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RedirectToRouteAssertions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RouteCollection_Extensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RouteDataAssertions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RouteValueDictionary_Extensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewResultAssertions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewResultBaseAssertions.cs" />
</ItemGroup>
</Project>
13 changes: 13 additions & 0 deletions src/FluentAssertions.Mvc.Shared/FluentAssertions.Mvc.Shared.shproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>0e46fc22-eb6a-431e-bfb3-47fbc4fc500f</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="FluentAssertions.Mvc.Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
using FluentAssertions.Execution;
using System;
using System.Web.Mvc;
using System.Diagnostics;
namespace FluentAssertions.Mvc
{
/// <summary>
/// Contains a number of methods to assert that a <see cref="ViewResult"/> is in the expected state.
/// </summary>
[DebuggerNonUserCode]
public class ViewResultAssertions : ViewResultBaseAssertions<ViewResult>
{
/// <summary>
/// Initializes a new instance of the <see cref="T:ViewResultAssertions" /> class.
/// </summary>
public ViewResultAssertions (ViewResult subject) : base(subject) { }
/// <summary>
/// Asserts that the master name is the expected master name.
/// </summary>
/// <param name="expectedMasterName">The expected master name.</param>
/// <param name="reason">
/// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// </param>
public ViewResultAssertions WithMasterName(string expectedMasterName, string reason = "", params object[] reasonArgs)
{
string actualMasterName = (Subject as ViewResult).MasterName;
Execute.Assertion
.ForCondition(string.Equals(expectedMasterName, actualMasterName, StringComparison.InvariantCultureIgnoreCase))
.BecauseOf(reason, reasonArgs)
.FailWith(FailureMessages.ViewResult_MasterName, expectedMasterName, actualMasterName);
return this;
}
}
}
using FluentAssertions.Execution;
using System;
using System.Web.Mvc;
using System.Diagnostics;

namespace FluentAssertions.Mvc
{
/// <summary>
/// Contains a number of methods to assert that a <see cref="ViewResult"/> is in the expected state.
/// </summary>
[DebuggerNonUserCode]
public class ViewResultAssertions : ViewResultBaseAssertions<ViewResult>
{
/// <summary>
/// Initializes a new instance of the <see cref="T:ViewResultAssertions" /> class.
/// </summary>
public ViewResultAssertions (ViewResult subject) : base(subject) { }

/// <summary>
/// Asserts that the master name is the expected master name.
/// </summary>
/// <param name="expectedMasterName">The expected master name.</param>
/// <param name="reason">
/// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// </param>
public ViewResultAssertions WithMasterName(string expectedMasterName, string reason = "", params object[] reasonArgs)
{
string actualMasterName = (Subject as ViewResult).MasterName;

Execute.Assertion
.ForCondition(string.Equals(expectedMasterName, actualMasterName, StringComparison.InvariantCultureIgnoreCase))
.BecauseOf(reason, reasonArgs)
.FailWith(FailureMessages.ViewResult_MasterName, expectedMasterName, actualMasterName);
return this;
}
}
}
Loading