TestBase-Mvc NuGet Package

*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).




Got any TestBase-Mvc Question?





Info

Version: 4.1.4.3
Author(s): Chris F Carroll
Last Update: Tuesday, November 20, 2018
.NET Fiddle: Create the first Fiddle
Project Url: http://github.com/chrisfcarroll/TestBase
NuGet Url: https://www.nuget.org/packages/TestBase-Mvc


Install
Install-Package TestBase-Mvc
dotnet add package TestBase-Mvc
paket add TestBase-Mvc
TestBase-Mvc Download (Unzip the "nupkg" after downloading)



Tags



STATS

must-have-score

.8

avg-downloads-per-day

7

days-since-last-release

1983