Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Theory]
- [InlineData("Test Article", "Test Article Content")]
- public void PostCreateShouldBeRoutedCorrectly(string title, string content)
- => MyRouting // Start a route test.
- .Configuration() // Use the globally registered configuration.
- .ShouldMap(request => request // Provide the request data.
- .WithMethod(HttpMethod.Post) // Set the method of the request.
- .WithLocation("/Articles/Create") // Set the URL of the Post request.
- .WithFormFields(new // Add form field data to the request.
- {
- Title = title,
- Content = content
- })
- .WithUser() // Specify that the route needs an authenticated user.
- .WithAntiForgeryToken()) // Add an Anti-Forgery token, if needed.
- .To<ArticlesController>(c => c.Create(new ArticleFormModel // Map the route to the specific route values.
- {
- Title = title,
- Content = content
- }));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement