ivaylokenov

Untitled

Nov 18th, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. [Fact]
  2. public void CreateGetShouldHaveRestrictionsForHttpGetOnlyAndAuthorizedUsersAndShouldReturnView()
  3.     => MyController<ArticlesController>               // Specify the controller under test.
  4.         .Instance()                                   // Create it from the globally registered services.
  5.         .Calling(c => c.Create())                     // Specify the action under test.
  6.         .ShouldHave()                                
  7.         .ActionAttributes(attrs => attrs              // Assert action attributes.
  8.             .RestrictingForHttpMethod(HttpMethod.Get)
  9.             .RestrictingForAuthorizedRequests())
  10.         .AndAlso()                                    // Provide additional assertions.
  11.         .ShouldReturn()                                
  12.         .View();                                      // Validate the view result.
Advertisement
Add Comment
Please, Sign In to add comment