Ivaylo Kenov
Ivaylo Kenov
Route tests should not execute the action and its action filters. A route test should only assert whether ASP.NET Core has the correct mapping of the URL and whether the...
`.Instance` should allow creating controllers and view components with inner builder like so: ```c# MyController .Instance(instance => instance .WithOptions(options => options .For(settings => settings.Cache = true)) .WithSession(session => session .WithEntry("MySession",...
```c# MyController .Instance() .WithUser(user => user .WithUsername("MyUserName")) .Calling(c => c.MyAction(myRequestModel)) .ShouldHave() .ValidModelState() .AndAlso() .ShouldReturn() .View(result => result .WithModelOfType() .Passing(model => { Assert.AreEqual(1, model.Id); Assert.AreEqual("My property value", model.MyProperty); })); .AndContinueTo() //...
It should show what is different in the result. It may be a simple JSON but it may highlight the difference.
The library should test the routes based on whether the endpoint routing is turned on or off. More information here: https://aregcode.com/blog/2019/dotnetcore-understanding-aspnet-endpoint-routing/
When `.But()` is implemented in #281 `Without` methods will be needed. Needed methods: - [ ] `WithoutData` in the EntityFrameworkCore package - [ ] `WithoutMemoryCache` in the Caching package -...
Example test: ```c# MyRouting .Configuration() .ShouldMap(request => request .WithMethod(HttpMethod.Post) .WithLocation("/My/Action") .WithFormFields(new { Title = title, Content = content }) .WithUser() .WithAntiForgeryToken()) .To(c => c.Action(new MyFormModel { Title = title, Content...
Sample tests should look like this: ```c# MyController .Instance() .WithUser(user => user .WithUsername("MyUserName")) .Calling(c => c.Index()) .ShouldReturn() .Ok() .But() .WithoutUser() .ShouldReturn() .Unathorized(); MyController .Instance() .Calling(c => c.Get(1)) .ShouldReturn() .Ok() .But()...
This should be a configuration option.
Currently `.WithSetupFor` will throw an exception if the service is registered as `IOptions`, no matter the lifetime.