TestBase-Mvc
3.0.2
dotnet add package TestBase-Mvc --version 3.0.2
NuGet\Install-Package TestBase-Mvc -Version 3.0.2
<PackageReference Include="TestBase-Mvc" Version="3.0.2" />
paket add TestBase-Mvc --version 3.0.2
#r "nuget: TestBase-Mvc, 3.0.2"
// Install TestBase-Mvc as a Cake Addin #addin nuget:?package=TestBase-Mvc&version=3.0.2 // Install TestBase-Mvc as a Cake Tool #tool nuget:?package=TestBase-Mvc&version=3.0.2
*TestBase* gets you off to a flying start when unit testing projects with dependencies.
TestBase-Mvc adds a rich extensible set of fluent assertions for verifying Mvc ActionResults and for easy setup of ControllerContext and HttpContext for both Mvc and WebApi
TestBase.Shoulds
-------------------
Chainable fluent assertions get you to the point concisely
ControllerUnderTest.Action()
.ShouldbeViewResult()
.ShouldHaveModel<TModel>()
.ShouldEqualByValue(expected)
ControllerUnderTest.Action()
.ShouldBeRedirectToRouteResult()
.ShouldHaveRouteValue("expectedKey", [Optional] "expectedValue");
ShouldHaveViewDataContaining(), ShouldBeJsonResult() etc.
TestBase
----------
Controller extensions to fake the http request & context. By injecting the RegisterRoutes method of your
MvcApplication, you can use and test Controller.Url with your application's configured routes.
ControllerUnderTest
.WithHttpContextAndRoutes(
[Optional] Action<RouteCollection> mvcApplicationRoutesRegistration,
[optional] string requestUrl,
[Optional] string query = "",
[Optional] string appVirtualPath = "/",
[Optional] HttpApplication applicationInstance)
ApiControllerUnderTest.WithWebApiHttpContext<T>(
HttpMethod httpMethod,
[Optional] string requestUri,
[Optional] string routeTemplate)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
- Microsoft.AspNet.Mvc (>= 4.0.20710)
- Microsoft.AspNet.WebApi.Core (>= 4.0.20710)
- Moq (>= 4.0.10827)
- NUnit (>= 2.6.3)
- TestBase (>= 3.0.2)
GitHub repositories
This package is not used by any popular GitHub repositories.
Version 1. Unpolished but in use for over a year