コード例 #1
0
 public void GetShouldHaveAuthorizedAttribute()
 {
     MyWebApi
     .Controller <CategoriesController>()
     .WithResolvedDependencyFor(TestObjectFactory.GetCategoriesService())
     .Calling(c => c.Post(TestObjectFactory.GetValidCategoryModel()))
     .ShouldHave()
     .ActionAttributes(attr => attr.RestrictingForAuthorizedRequests());
 }
コード例 #2
0
 public void PostShouldValidateModelState()
 {
     MyWebApi
     .Controller <CategoriesController>()
     .WithResolvedDependencyFor(TestObjectFactory.GetCategoriesService())
     .Calling(c => c.Post(TestObjectFactory.GetValidCategoryModel()))
     .ShouldHave()
     .ValidModelState();
 }
コード例 #3
0
 public void GetShouldHaveCorsEnabled()
 {
     MyWebApi
     .Controller <CategoriesController>()
     .WithResolvedDependencyFor(TestObjectFactory.GetCategoriesService())
     .Calling(c => c.Get())
     .ShouldHave()
     .ActionAttributes(attr => attr.ContainingAttributeOfType <EnableCorsAttribute>());
 }
コード例 #4
0
 public void GetShouldReturnNotFoundWhenProjectIsNull()
 {
     MyWebApi
     .Controller <CategoriesController>()
     .WithResolvedDependencyFor(TestObjectFactory.GetCategoriesService())
     .WithAuthenticatedUser()
     .Calling(c => c.GetById("Invalid"))
     .ShouldReturn()
     .NotFound();
 }