Advertisement
ivaylokenov

Untitled

Nov 18th, 2019
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. [Fact]
  2. public void CreatePostShouldHaveRestrictionsForHttpPostOnlyAndAuthorizedUsers()
  3.     => MyController<ArticlesController>                         // Specify the controller under test.
  4.         .Instance()                                             // Create it from the globally registered services.
  5.         .Calling(c => c.Create(With.Empty<ArticleFormModel>())) // Specify the action under test and provide empty model.
  6.         .ShouldHave()
  7.         .ActionAttributes(attrs => attrs                        // Assert action attributes.
  8.             .RestrictingForHttpMethod(HttpMethod.Post)
  9.             .RestrictingForAuthorizedRequests());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement