Skip to content

Commit ef5b5ee

Browse files
committed
Updated README.md
1 parent 6dbdb6c commit ef5b5ee

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ MyMvc
9090
.ShouldMap(request => request
9191
.WithLocation("/My/Action/1")
9292
.WithMethod(HttpMethod.Post)
93+
.WithAuthenticatedUser()
94+
.WithAntiForgeryToken()
9395
.WithJsonBody(new
9496
{
9597
Integer = 1,
@@ -125,6 +127,31 @@ MyMvc
125127
Assert.AreEqual(1, m.Id);
126128
Assert.AreEqual("Some property value", m.SomeProperty);
127129
});
130+
131+
// instantiates controller with the registered services
132+
// and sets options for the current test
133+
// and sets session for the current test
134+
// and sets DbContext for the current test
135+
// and tests for added cache entry by the action
136+
// and tests model from view result
137+
MyMvc
138+
.Controller<MvcController>()
139+
.WithOptions(options => options
140+
.For<AppSettings>(settings => settings.Cache = true))
141+
.WithSession(session => session
142+
.WithEntry("Session", "SessionValue"))
143+
.WithDbContext(db => db.WithEntities(entities => entities
144+
.AddRange(SampleDataProvider.GetModels())))
145+
.Calling(c => c.SomeAction())
146+
.ShouldHave()
147+
.MemoryCache(cache => cache
148+
.ContainingEntry(entry => entry
149+
.WithKey("CacheEntry")
150+
.WithSlidingExpiration(TimeSpan.FromMinutes(10))))
151+
.AndAlso()
152+
.ShouldReturn()
153+
.View()
154+
.WithModelOfType<ResponseModel>();
128155

129156
// tests whether the action is declared with filters
130157
MyMvc
@@ -167,7 +194,7 @@ Code by Ivaylo Kenov. Copyright 2015 Ivaylo Kenov ([http://mytestedasp.net](http
167194

168195
**Currently MyTested.AspNetCore.Mvc is in alpha version and it is not advised to use it in production environments. The testing framework is fully tested and working correctly but the fluent APIs may change in the final production-ready build.**
169196

170-
MyTested.AspNetCore.Mvc source code is available under GNU Affero General Public License/FOSS License Exception. The free version of the library allows up to 500 assertions (around 100 test cases) per test project. Additionally, full-featured licenses can be requested for free by individuals, startups and educational institutions. Commercial licensing with private support will also be available with the final release.
197+
MyTested.AspNetCore.Mvc source code is available under GNU Affero General Public License/FOSS License Exception. The free version of the library allows up to 500 assertions (around 100 test cases) per test project. Additionally, full-featured licenses can be requested for free by individuals, open-source projects, startups and educational institutions. Commercial licensing with private support will also be available with the final release.
171198

172199
See the [LICENSE](https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc/blob/master/LICENSE) for detailed information.
173200

samples/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
MyTested.AspNetCore.Mvc Samples
2+
====================================
3+
4+
Here you can find couple of working samples, which will get you started with the library.
5+
6+
## Application Samples
7+
8+
- MusicStore - sample showing how to use MyTested.AspNetCore.Mvc with automatic TestStartup class for unit testing controllers and routes. It uses the [official ASP.NET Core MVC sample](https://github.com/aspnet/MusicStore).
9+
10+
## Functional Test Samples
11+
12+
- ApplicationParts - minimalistic functional sample testing whether controllers are found correctly when registered from external assemblies.

0 commit comments

Comments
 (0)