ivaylokenov

Untitled

Nov 18th, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. [Fact]
  2. public void CreatePostShouldReturnViewWithSameModelWhenInvalidModelState()
  3.     => MyController<ArticlesController>                            // Specify the controller under test.
  4.         .Instance()                                                // Create it from the globally registered services.
  5.         .Calling(c => c.Create(With.Default<ArticleFormModel>()))  // Specify the action under test and provide empty model.
  6.         .ShouldHave()
  7.         .InvalidModelState()                                       // Assert invalid model state.
  8.         .AndAlso()                                                 // Provide additional assertions.
  9.         .ShouldReturn()
  10.         .View(With.Default<ArticleFormModel>());                   // Validate the view result and the same empty model.
Advertisement
Add Comment
Please, Sign In to add comment