Skip to content

Commit 475c3aa

Browse files
committed
Created some sample code. Added fail message checking to some tests
1 parent 5fe3940 commit 475c3aa

20 files changed

+150
-77
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ test-results
99
cmd.exe
1010
[Pp]ackage
1111
[Gg]it [Bb]ash.lnk
12-
[Ii]nore
12+
[Ii]nore
13+
FluentAssertionsMvc.VisualState.xml
14+
[Rr]elease
15+
TestResult.xml

FluentAssertionsMvc.VisualState.xml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<VisualState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ShowCheckBoxes="false">
33
<TopNode>[0-1000]G:\Dev\FluentAssertions.MVC\FluentAssertionsMvc.nunit</TopNode>
4-
<SelectedNode>[0-1062]G:\Dev\FluentAssertions.MVC\tests\FluentAssertions.Mvc3.Tests\bin\Debug\FluentAssertions.Mvc3.Tests.dll</SelectedNode>
4+
<SelectedNode>[0-1074]FluentAssertions.Mvc3.Tests.RedirectToRoute_Tests.WithArea_GivenUnexpected_ShouldFail</SelectedNode>
55
<ExcludeCategories>false</ExcludeCategories>
66
<Nodes>
77
<Node UniqueName="[0-1000]G:\Dev\FluentAssertions.MVC\FluentAssertionsMvc.nunit" Expanded="true" />
8-
<Node UniqueName="[0-1062]G:\Dev\FluentAssertions.MVC\tests\FluentAssertions.Mvc3.Tests\bin\Debug\FluentAssertions.Mvc3.Tests.dll" Expanded="true" />
9-
<Node UniqueName="[0-1063]FluentAssertions" Expanded="true" />
10-
<Node UniqueName="[0-1064]FluentAssertions.Mvc3" Expanded="true" />
11-
<Node UniqueName="[0-1065]FluentAssertions.Mvc3.Tests" Expanded="true" />
8+
<Node UniqueName="[0-1075]G:\Dev\FluentAssertions.MVC\bin\Debug\Test\FluentAssertions.Mvc3.Tests.dll" Expanded="true" />
9+
<Node UniqueName="[0-1076]FluentAssertions" Expanded="true" />
10+
<Node UniqueName="[0-1077]FluentAssertions.Mvc3" Expanded="true" />
11+
<Node UniqueName="[0-1078]FluentAssertions.Mvc3.Tests" Expanded="true" />
1212
<Node UniqueName="[0-1049]FluentAssertions.Mvc3.Tests.ActionResultAssertions_Tests" Expanded="true" />
1313
<Node UniqueName="[0-1008]FluentAssertions.Mvc3.Tests.ContentResultAssertions_Tests" Expanded="true" />
1414
<Node UniqueName="[0-1047]FluentAssertions.Mvc3.Tests.RedirectResultAssertions_Tests" Expanded="true" />
15+
<Node UniqueName="[0-1062]FluentAssertions.Mvc3.Tests.RedirectToRoute_Tests" Expanded="true" />
1516
<Node UniqueName="[0-1033]FluentAssertions.Mvc3.Tests.RouteDataAssertions_Tests" Expanded="true" />
1617
<Node UniqueName="[0-1001]FluentAssertions.Mvc3.Tests.RouteValueDictionary_Extensions_Tests" Expanded="true" />
1718
<Node UniqueName="[0-1015]FluentAssertions.Mvc3.Tests.ViewResultAssertions_Tests" Expanded="true" />
18-
<Node UniqueName="[0-1127]G:\Dev\FluentAssertions.MVC\bin\Debug\Test\FluentAssertions.Mvc3.Tests.dll" Expanded="true" />
19-
<Node UniqueName="[0-1128]FluentAssertions" Expanded="true" />
20-
<Node UniqueName="[0-1129]FluentAssertions.Mvc3" Expanded="true" />
21-
<Node UniqueName="[0-1130]FluentAssertions.Mvc3.Tests" Expanded="true" />
2219
</Nodes>
2320
</VisualState>

FluentAssertionsMvc.nunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<NUnitProject>
2-
<Settings activeconfig="Debug" processModel="Default" domainUsage="Default" />
2+
<Settings activeconfig="Debug" />
33
<Config name="Debug" binpathtype="Auto">
44
<assembly path="bin\Debug\Test\FluentAssertions.Mvc3.Tests.dll" />
55
</Config>

Package.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ echo.
88
echo *** BUILD SUCCESSFUL ***
99
echo.
1010

11-
cd package
11+
cd release
1212
nuget pack
1313
if errorlevel 1 goto PackageFail
1414

_todo_.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,10 @@
55
[ ] Change all dictionary asserts to us Subject.RouteValues.Should().Contain
66
[ ] FluentAssertions should *not* blow up if given null reasonArgs and a reason
77
[ ] Should because syntax in sample code
8-
[ ] XML comments every where
8+
[ ] XML comments every where
9+
[ ] Should assertions be more domain focused? i.e. routes.Should().MapTo()...
10+
[ ] Create RouteCollection.GenerateUrl(RouteValues)
11+
[ ] Need to test reason injection into fail messages
12+
[ ] Every mvc assertion type needs to inherit from ObjectAssertions
13+
[ ] If .BecauseOf isn't called FluentAssertions blows up
14+
[ ] Consolidate all messages into central resource file
Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Web;
5-
using System.Web.Mvc;
1+
using System.Web.Mvc;
62

73
namespace FluentAssertions.Mvc3.Samples.Controllers
84
{
95
public class ProductController : Controller
106
{
11-
//
12-
// GET: /Product/
13-
14-
public ActionResult Index()
7+
public ActionResult List()
158
{
16-
return View();
9+
return View("Index");
1710
}
18-
1911
}
2012
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
<Compile Include="Services\IProductService.cs" />
7878
<Compile Include="Services\ProductService.cs" />
7979
<Compile Include="Tests\ProductController_Tests.cs" />
80+
<Compile Include="Tests\Route_Tests.cs" />
8081
</ItemGroup>
8182
<ItemGroup>
8283
<Content Include="Content\themes\base\images\ui-bg_flat_0_aaaaaa_40x100.png" />

samples/FluentAssertions.Mvc3.Samples/Global.asax.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ public static void RegisterRoutes(RouteCollection routes)
2121
{
2222
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
2323

24+
routes.MapRoute(
25+
name: "ProductIndex",
26+
url: "Product/List",
27+
defaults: new
28+
{
29+
Controller = "Product",
30+
Action = "List"
31+
});
32+
2433
routes.MapRoute(
2534
"Default", // Route name
2635
"{controller}/{action}/{id}", // URL with parameters

samples/FluentAssertions.Mvc3.Samples/Models/ProductViewModel.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Web;
5-
1+

62
namespace FluentAssertions.Mvc3.Samples.Models
73
{
84
public class ProductViewModel

samples/FluentAssertions.Mvc3.Samples/Services/IProductService.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Web;
1+
using System.Collections.Generic;
52
using FluentAssertions.Mvc3.Samples.Models;
63

74
namespace FluentAssertions.Mvc3.Samples.Services

0 commit comments

Comments
 (0)