public void GetShouldHaveAuthorizedAttribute() { MyWebApi .Controller <CategoriesController>() .WithResolvedDependencyFor(TestObjectFactory.GetCategoriesService()) .Calling(c => c.Post(TestObjectFactory.GetValidCategoryModel())) .ShouldHave() .ActionAttributes(attr => attr.RestrictingForAuthorizedRequests()); }
public void PostShouldValidateModelState() { MyWebApi .Controller <CategoriesController>() .WithResolvedDependencyFor(TestObjectFactory.GetCategoriesService()) .Calling(c => c.Post(TestObjectFactory.GetValidCategoryModel())) .ShouldHave() .ValidModelState(); }
public void GetShouldHaveCorsEnabled() { MyWebApi .Controller <CategoriesController>() .WithResolvedDependencyFor(TestObjectFactory.GetCategoriesService()) .Calling(c => c.Get()) .ShouldHave() .ActionAttributes(attr => attr.ContainingAttributeOfType <EnableCorsAttribute>()); }
public void GetShouldReturnNotFoundWhenProjectIsNull() { MyWebApi .Controller <CategoriesController>() .WithResolvedDependencyFor(TestObjectFactory.GetCategoriesService()) .WithAuthenticatedUser() .Calling(c => c.GetById("Invalid")) .ShouldReturn() .NotFound(); }