Skip to content

Commit c8d6ec7

Browse files
author
CaseyBurns
committed
added sample code project
1 parent 4ec1c6e commit c8d6ec7

File tree

11 files changed

+293
-116
lines changed

11 files changed

+293
-116
lines changed

src/FluentAssertions.Mvc.Tests/ActionResultAssertions_Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
22
using NUnit.Framework;
3-
using FluentAssertions.Mvc.Tests.Fakes;
3+
using FluentAssertions.Mvc3.Tests.Fakes;
44
using System.Web.Mvc;
55
using FluentAssertions.Mvc3;
66

Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<PropertyGroup>
4-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6-
<ProductVersion>10.0.0</ProductVersion>
7-
<SchemaVersion>2.0</SchemaVersion>
8-
<ProjectGuid>{3CB00FF9-3DC2-460F-82E8-EBFB6339247D}</ProjectGuid>
9-
<OutputType>Library</OutputType>
10-
<RootNamespace>FluentAssertions.Mvc.Tests</RootNamespace>
11-
<AssemblyName>FluentAssertions.Mvc.Tests</AssemblyName>
12-
</PropertyGroup>
13-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14-
<DebugSymbols>true</DebugSymbols>
15-
<DebugType>full</DebugType>
16-
<Optimize>false</Optimize>
17-
<OutputPath>bin\Debug</OutputPath>
18-
<DefineConstants>DEBUG;</DefineConstants>
19-
<ErrorReport>prompt</ErrorReport>
20-
<WarningLevel>4</WarningLevel>
21-
<ConsolePause>false</ConsolePause>
22-
</PropertyGroup>
23-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
24-
<DebugType>none</DebugType>
25-
<Optimize>false</Optimize>
26-
<OutputPath>bin\Release</OutputPath>
27-
<ErrorReport>prompt</ErrorReport>
28-
<WarningLevel>4</WarningLevel>
29-
<ConsolePause>false</ConsolePause>
30-
</PropertyGroup>
31-
<ItemGroup>
32-
<Reference Include="System" />
33-
<Reference Include="System.Web" />
34-
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
35-
<Private>False</Private>
36-
</Reference>
37-
<Reference Include="System.Web.Routing" />
38-
<Reference Include="System.Xml.Linq" />
39-
<Reference Include="System.Xml" />
40-
<Reference Include="FluentAssertions">
41-
<HintPath>..\..\lib\FluentAssertions.1.7.0\Lib\net40\FluentAssertions.dll</HintPath>
42-
</Reference>
43-
<Reference Include="nunit.framework">
44-
<HintPath>..\..\lib\NUnit.2.6.0.12054\lib\nunit.framework.dll</HintPath>
45-
</Reference>
46-
</ItemGroup>
47-
<ItemGroup>
48-
<Compile Include="AssemblyInfo.cs" />
49-
<Compile Include="Fakes\FakeController.cs" />
50-
<Compile Include="ActionResultAssertions_Tests.cs" />
51-
<Compile Include="ViewResultAssertions_Tests.cs" />
52-
</ItemGroup>
53-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
54-
<ItemGroup />
55-
<ItemGroup>
56-
<ProjectReference Include="..\FluentAssertions.Mvc3\FluentAssertions.Mvc3.csproj">
57-
<Project>{53589F79-0908-409A-8366-3E18DC637600}</Project>
58-
<Name>FluentAssertions.Mvc3</Name>
59-
</ProjectReference>
60-
</ItemGroup>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>10.0.0</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{3CB00FF9-3DC2-460F-82E8-EBFB6339247D}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<RootNamespace>FluentAssertions.Mvc.Tests</RootNamespace>
11+
<AssemblyName>FluentAssertions.Mvc.Tests</AssemblyName>
12+
</PropertyGroup>
13+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14+
<DebugSymbols>true</DebugSymbols>
15+
<DebugType>full</DebugType>
16+
<Optimize>false</Optimize>
17+
<OutputPath>bin\Debug</OutputPath>
18+
<DefineConstants>DEBUG;</DefineConstants>
19+
<ErrorReport>prompt</ErrorReport>
20+
<WarningLevel>4</WarningLevel>
21+
<ConsolePause>false</ConsolePause>
22+
</PropertyGroup>
23+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
24+
<DebugType>none</DebugType>
25+
<Optimize>false</Optimize>
26+
<OutputPath>bin\Release</OutputPath>
27+
<ErrorReport>prompt</ErrorReport>
28+
<WarningLevel>4</WarningLevel>
29+
<ConsolePause>false</ConsolePause>
30+
</PropertyGroup>
31+
<ItemGroup>
32+
<Reference Include="System" />
33+
<Reference Include="System.Web" />
34+
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
35+
<Private>False</Private>
36+
</Reference>
37+
<Reference Include="System.Web.Routing" />
38+
<Reference Include="System.Xml.Linq" />
39+
<Reference Include="System.Xml" />
40+
<Reference Include="FluentAssertions">
41+
<HintPath>..\..\lib\FluentAssertions.1.7.0\Lib\net40\FluentAssertions.dll</HintPath>
42+
</Reference>
43+
<Reference Include="nunit.framework">
44+
<HintPath>..\..\lib\NUnit.2.6.0.12054\lib\nunit.framework.dll</HintPath>
45+
</Reference>
46+
</ItemGroup>
47+
<ItemGroup>
48+
<Compile Include="AssemblyInfo.cs" />
49+
<Compile Include="Fakes\FakeController.cs" />
50+
<Compile Include="ActionResultAssertions_Tests.cs" />
51+
<Compile Include="ViewResultAssertions_Tests.cs" />
52+
</ItemGroup>
53+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
54+
<ItemGroup />
55+
<ItemGroup>
56+
<ProjectReference Include="..\FluentAssertions.Mvc3\FluentAssertions.Mvc3.csproj">
57+
<Project>{53589F79-0908-409A-8366-3E18DC637600}</Project>
58+
<Name>FluentAssertions.Mvc3</Name>
59+
</ProjectReference>
60+
</ItemGroup>
6161
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
using System.Reflection;
2-
using System.Runtime.CompilerServices;
3-
4-
// Information about this assembly is defined by the following attributes.
5-
// Change them to the values specific to your project.
6-
7-
[assembly: AssemblyTitle("FluentAssertions.Mvc.Tests")]
8-
[assembly: AssemblyDescription("")]
9-
[assembly: AssemblyConfiguration("")]
10-
[assembly: AssemblyCompany("")]
11-
[assembly: AssemblyProduct("")]
12-
[assembly: AssemblyCopyright("Casey Burns")]
13-
[assembly: AssemblyTrademark("")]
14-
[assembly: AssemblyCulture("")]
15-
16-
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17-
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
18-
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
19-
20-
[assembly: AssemblyVersion("1.0.*")]
21-
22-
// The following attributes are used to specify the signing key for the assembly,
23-
// if desired. See the Mono documentation for more information about signing.
24-
25-
//[assembly: AssemblyDelaySign(false)]
26-
//[assembly: AssemblyKeyFile("")]
27-
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
4+
// Information about this assembly is defined by the following attributes.
5+
// Change them to the values specific to your project.
6+
7+
[assembly: AssemblyTitle("FluentAssertions.Mvc3.Tests")]
8+
[assembly: AssemblyDescription("")]
9+
[assembly: AssemblyConfiguration("")]
10+
[assembly: AssemblyCompany("")]
11+
[assembly: AssemblyProduct("")]
12+
[assembly: AssemblyCopyright("Casey Burns")]
13+
[assembly: AssemblyTrademark("")]
14+
[assembly: AssemblyCulture("")]
15+
16+
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17+
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
18+
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
19+
20+
[assembly: AssemblyVersion("1.0.0.0")]
21+
22+
// The following attributes are used to specify the signing key for the assembly,
23+
// if desired. See the Mono documentation for more information about signing.
24+
25+
//[assembly: AssemblyDelaySign(false)]
26+
//[assembly: AssemblyKeyFile("")]
27+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Web.Routing;
6+
using System.Web.Mvc;
7+
8+
namespace FluentAssertions.Mvc.Tests
9+
{
10+
public class RouteDataAssertions_Tests
11+
{
12+
private RouteCollection _routes;
13+
14+
public RouteDataAssertions_Tests()
15+
{
16+
_routes = new RouteCollection();
17+
_routes.Add(new Route("{controller}/{action}/{id}", new MvcRouteHandler())
18+
{
19+
Defaults = new RouteValueDictionary(new
20+
{
21+
Controller = "Home",
22+
Action = "Index",
23+
Id = UrlParameter.Optional
24+
}),
25+
});
26+
}
27+
}
28+
}

src/FluentAssertions.Mvc.Tests/ViewResultAssertions_Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using NUnit.Framework;
66
using System.Web.Mvc;
77
using FluentAssertions.Mvc3;
8-
using FluentAssertions.Mvc.Tests.Fakes;
8+
using FluentAssertions.Mvc3.Tests.Fakes;
99

1010
namespace FluentAssertions.Mvc3.Tests
1111
{
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using FluentAssertions;
6+
using FluentAssertions.Mvc3.Samples.Controllers;
7+
using FluentAssertions.Mvc3;
8+
using FluentAssertions.Mvc3.Samples.Models;
9+
10+
namespace FluentAssertions.Mvc3.Samples
11+
{
12+
public class ActionResultSamples
13+
{
14+
public void ViewResult_Sample()
15+
{
16+
var controller = new HomeController();
17+
var result = controller.Index();
18+
19+
result.Should().BeView()
20+
.WithViewName("Start")
21+
.WithTempData("Message", "Welcome")
22+
.ModelAs<WelcomeModel>().UserName.Should().Be("Jonny Briggs");
23+
}
24+
}
25+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System.Web.Mvc;
2+
using FluentAssertions.Mvc3.Samples.Models;
3+
4+
namespace FluentAssertions.Mvc3.Samples.Controllers
5+
{
6+
public class HomeController : Controller
7+
{
8+
public ActionResult Index()
9+
{
10+
TempData["Message"] = "Welcome!";
11+
12+
var model = new WelcomeModel
13+
{
14+
UserName = "Jonny Briggs",
15+
UserAge = 41
16+
};
17+
18+
return View("Welcome", model);
19+
}
20+
}
21+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>c791f407-a2ac-4908-9fb4-0041fdc5d992</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>FluentAssertions.Mvc3.Samples</RootNamespace>
12+
<AssemblyName>FluentAssertions.Mvc3.Samples</AssemblyName>
13+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<DebugType>pdbonly</DebugType>
27+
<Optimize>true</Optimize>
28+
<OutputPath>bin\Release\</OutputPath>
29+
<DefineConstants>TRACE</DefineConstants>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
</PropertyGroup>
33+
<ItemGroup>
34+
<Reference Include="System" />
35+
<Reference Include="System.Core" />
36+
<Reference Include="System.Xml.Linq" />
37+
<Reference Include="System.Data.DataSetExtensions" />
38+
<Reference Include="Microsoft.CSharp" />
39+
<Reference Include="System.Data" />
40+
<Reference Include="System.Xml" />
41+
</ItemGroup>
42+
<ItemGroup>
43+
<Compile Include="Class1.cs" />
44+
<Compile Include="Properties\AssemblyInfo.cs" />
45+
</ItemGroup>
46+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
47+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
48+
Other similar extension points exist, see Microsoft.Common.targets.
49+
<Target Name="BeforeBuild">
50+
</Target>
51+
<Target Name="AfterBuild">
52+
</Target>
53+
-->
54+
</Project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace FluentAssertions.Mvc3.Samples.Models
7+
{
8+
public class WelcomeModel
9+
{
10+
public string UserName { get; set; }
11+
public int UserAge { get; set; }
12+
}
13+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("FluentAssertions.Mvc3.Samples")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("FluentAssertions.Mvc3.Samples")]
13+
[assembly: AssemblyCopyright("Copyright © 2012")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("c791f407-a2ac-4908-9fb4-0041fdc5d992")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)