You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-90Lines changed: 27 additions & 90 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,153 +3,90 @@ MyTested.Mvc - Fluent testing<br /> for ASP.NET Core MVC</h1>
3
3
4
4
MyTested.Mvc is a unit testing library providing easy fluent interface to test the [ASP.NET Core MVC](https://github.com/aspnet/Mvc) framework. It is testing framework agnostic, so you can combine it with a test runner of your choice (e.g. xUnit, NUnit, etc.).
5
5
6
-
## Tutorial and documentation
6
+
## Getting started
7
7
8
-
Please see the [documentation](https://github.com/ivaylokenov/MyTested.WebApi/tree/master/documentation) for full list of available features. Everything listed in the documentation is 100% covered by [more than 800 unit tests](https://github.com/ivaylokenov/MyTested.WebApi/tree/master/src/MyTested.WebApi.Tests) and should work correctly. Almost all items in the [issues page](https://github.com/ivaylokenov/MyTested.WebApi/issues) are expected future features and enhancements.
8
+
It is strongly advised to start with the [tutorial](http://ivaylokenov.github.io/MyTested.Mvc/tutorial/intro.html) in order to get familiar with MyTested.Mvc. Additionally, you may see the [documentation](http://ivaylokenov.github.io/MyTested.Mvc/guide/intro.html) for full list of available features. MyTested.Mvc is 100% covered by [more than 1500 unit tests](https://github.com/ivaylokenov/MyTested.Mvc/tree/master/test/) and should work correctly. Almost all items in the [issues page](https://github.com/ivaylokenov/MyTested.Mvc/issues) are expected future features and enhancements.
9
9
10
10
## Installation
11
11
12
-
You can install this library using NuGet into your Test class project. It will automatically reference the needed dependencies of Microsoft.AspNet.WebApi.Core (≥ 5.1.0) and Microsoft.Owin.Testing (≥ 3.0.1) for you. .NET 4.5+ is needed. Make sure your solution has the same versions of the mentioned dependencies in all projects where you are using them. For example, if you are using Microsoft.AspNet.WebApi.Core 5.2.3 in your Web project, the same version should be used after installing MyTested.WebApi in your Tests project.
12
+
You can install this library using NuGet into your test project (or reference it directly in your `project.json` file). Currently MyTested.Mvc works with ASP.NET Core MVC RC2.
13
13
14
-
Install-Package MyTested.WebApi
14
+
Install-Package MyTested.Mvc
15
15
16
-
After the downloading is complete, just add `using MyTested.WebApi;` and you are ready to test in the most elegant and developer friendly way.
16
+
After the downloading is complete, just add `using MyTested.Mvc;` to your source code and you are ready to test in the most elegant and developer friendly way.
17
17
18
-
using MyTested.WebApi;
18
+
using MyTested.Mvc;
19
19
20
20
For other interesting packages check out:
21
21
22
+
-[MyTested.WebApi](https://github.com/ivaylokenov/MyTested.WebApi) - fluent testing framework for ASP.NET Web API 2
23
+
-[MyTested.HttpServer](https://github.com/ivaylokenov/MyTested.HttpServer) - fluent testing framework for remote HTTP servers
22
24
-[AspNet.Mvc.TypedRouting](https://github.com/ivaylokenov/AspNet.Mvc.TypedRouting) - typed routing and link generation for ASP.NET Core MVC
23
25
-[ASP.NET MVC 5 Lambda Expression Helpers](https://github.com/ivaylokenov/ASP.NET-MVC-Lambda-Expression-Helpers) - typed expression based link generation for ASP.NET MVC 5
24
26
25
27
## How to use
26
28
27
-
Make sure to check out [the documentation](https://github.com/ivaylokenov/MyTested.WebApi/tree/master/documentation) for full list of available features.
28
-
You can also check out [the provided samples](https://github.com/ivaylokenov/MyTested.WebApi/tree/master/samples) for real-life ASP.NET Web API application testing.
29
+
Make sure to check out the [tutorial](http://ivaylokenov.github.io/MyTested.Mvc/tutorial/intro.html) and the [documentation](http://ivaylokenov.github.io/MyTested.Mvc/guide/intro.html) for a preview of the available features.
30
+
You can also check out the [provided samples](https://github.com/ivaylokenov/MyTested.Mvc/tree/master/samples) for real-life ASP.NET Core MVC application testing.
29
31
30
-
Basically you can create a test case by using the fluent API the library provides. You are given a static `MyWebApi` class from which all assertions can be easily configured.
32
+
Basically you can create a test case by using the fluent API the library provides. You are given a static `MyMvc` class from which all assertions can be easily configured.
31
33
32
34
```c#
33
35
namespaceMyApp.Tests.Controllers
34
36
{
35
-
usingMyTested.WebApi;
37
+
usingMyTested.Mvc;
36
38
37
39
usingMyApp.Controllers;
38
-
usingNUnit.Framework;
40
+
usingXunit;
39
41
40
-
[TestFixture]
41
42
publicclassHomeControllerShould
42
43
{
43
-
[Test]
44
-
publicvoidReturnOkWhenCallingGetAction()
44
+
[Fact]
45
+
publicvoidReturnViewWhenCallingIndexAction()
45
46
{
46
-
MyWebApi
47
+
MyMvc
47
48
.Controller<HomeController>()
48
-
.Calling(c=>c.Get())
49
+
.Calling(c=>c.Index())
49
50
.ShouldReturn()
50
-
.Ok();
51
+
.View();
51
52
}
52
53
}
53
54
}
54
55
```
55
56
56
-
The example uses NUnit but you can use whatever testing framework you want.
57
-
Basically, MyTested.WebApi throws an unhandled exception if the assertion does not pass and the test fails.
57
+
The example uses [xUnit](http://xunit.github.io/) but you can use whatever testing framework you want.
58
+
Basically, MyTested.Mvc throws an unhandled exception with a friendly error message if the assertion does not pass and the test fails.
58
59
59
60
Here are some random examples of what the fluent testing API is capable of:
60
61
61
62
```c#
62
63
// tests a route for correct controller, action and resolved route values
Code by Ivaylo Kenov. Copyright 2015 Ivaylo Kenov.
84
+
Code by Ivaylo Kenov. Copyright 2015 Ivaylo Kenov ([http://mytestedasp.net](http://mytestedasp.net))
145
85
146
-
This library is intended to be used in both open-source and commercial environments. To allow its use in as many
147
-
situations as possible, MyTested.WebApi is dual-licensed. You may choose to use MyTested.WebApi under either the Apache License,
148
-
Version 2.0, or the Microsoft Public License (Ms-PL). These licenses are essentially identical, but you are
149
-
encouraged to evaluate both to determine which best fits your intended use.
86
+
MyTested.Mvc source code is available under GNU Affero General Public License/FOSS License Exception. Additionally, full-featured licenses can be requested for free by individuals, startups and educational institutions. Commercial licensing with private support is also available.
150
87
151
-
Refer to the [LICENSE](https://github.com/ivaylokenov/MyTested.WebApi/blob/master/LICENSE) for detailed information.
88
+
See [https://mytestedasp.net/products/mvc#pricing](https://mytestedasp.net/products/mvc#pricing) and the [LICENSE](https://github.com/ivaylokenov/MyTested.Mvc/blob/master/LICENSE) for detailed information.
152
89
153
90
## Any questions, comments or additions?
154
91
155
-
If you have a feature request or bug report, leave an issue on the [issues page](https://github.com/ivaylokenov/MyTested.WebApi/issues) or send a [pull request](https://github.com/ivaylokenov/MyTested.WebApi/pulls). For general questions and comments, use the [StackOverflow](http://stackoverflow.com/) forum.
92
+
If you have a feature request or bug report, leave an issue on the [issues page](https://github.com/ivaylokenov/MyTested.Mvc/issues) or send a [pull request](https://github.com/ivaylokenov/MyTested.Mvc/pulls). For general questions and comments, use the [StackOverflow](http://stackoverflow.com/) forum.
0 commit comments