public void ConfirmDeleteShouldHaveRestrictionsForAuthorizedUsers()
 => MyController <ArticlesController>
 .Instance()
 .Calling(c => c.ConfirmDelete(With.Empty <int>()))
 .ShouldHave()
 .ActionAttributes(attrs => attrs
                   .RestrictingForAuthorizedRequests());
Beispiel #2
0
 public void EditGetShouldHaveRestrictionsForHttpGetOnlyAndAuthorizedUsers()
 => MyController <ArticlesController>
 .Calling(c => c.Edit(With.Empty <int>()))
 .ShouldHave()
 .ActionAttributes(attrs => attrs
                   .RestrictingForHttpMethod(HttpMethod.Get)
                   .RestrictingForAuthorizedRequests());
Beispiel #3
0
 public void CreatePostShouldHaveRestrictionsForHttpPostOnlyAndAuthorizedUsers()
 => MyController <ArticlesController>
 .Calling(c => c.Create(With.Empty <ArticleFormModel>()))
 .ShouldHave()
 .ActionAttributes(attrs => attrs
                   .RestrictingForHttpMethod(HttpMethod.Post)
                   .RestrictingForAuthorizedRequests());
 public void EditPostShouldReturnNotFoundWhenNonAuthorUser()
 => MyController <ArticlesController>
 .Instance()
 .WithUser(user => user.WithIdentifier("NonAuthor"))
 .WithData(ArticleTestData.GetArticles(1))
 .Calling(c => c.Edit(1, With.Empty <ArticleFormModel>()))
 .ShouldReturn()
 .NotFound();
 public void GetShouldReturnAvailableCarAdsWithoutAQuery()
 => MyPipeline
 .Configuration()
 .ShouldMap("/CarAds")
 .To <CarAdsController>(c => c.Search(With.Empty <SearchCarAdsQuery>()))
 .Which(instance => instance
        .WithData(CarAdFakes.Data.GetCarAds()))
 .ShouldReturn()
 .ActionResult <SearchCarAdsOutputModel>(result => result
                                         .Passing(model => model
                                                  .CarAds.Count().Should().Be(10)));
 public void GetShouldReturnAllCarAdsWithoutAQuery(int totalCarAds)
 => MyPipeline
 .Configuration()
 .ShouldMap("/CarAds")
 .To <CarAdsController>(c => c.Search(With.Empty <SearchCarAdsQuery>()))
 .Which(instance => instance
        .WithData(A.CollectionOfDummy <CarAd>(totalCarAds)))
 .ShouldReturn()
 .ActionResult <SearchCarAdsOutputModel>(result => result
                                         .Passing(model => model
                                                  .CarAds.Count().Should().Be(totalCarAds)));
Beispiel #7
0
        public void SearchShouldReturnAvailableArticlesWithoutAQuery()
        => MyPipeline
        .Configuration()
        .ShouldMap("/Articles")

        .To <ArticlesController>(c => c.Search(With.Empty <SearchArticlesQuery>()))
        .Which(instance => instance
               .WithData(JournalistFakes.Data.GetJournalist()))

        .ShouldReturn()
        .ActionResult <SearchArticlesOutputModel>(result => result
                                                  .Passing(model => model
                                                           .Articles.Count().Should().Be(10)));
        public void SearchShouldReturnAprovedReportsWithoutAQuery()
        => MyPipeline
        .Configuration()
        .ShouldMap("/Reports")

        .To <ReportsController>(c => c.Search(With.Empty <SearchReportsQuery>()))
        .Which(instance => instance
               .WithData(ReporterFakes.Data.GetReporter()))

        .ShouldReturn()
        .ActionResult <SearchReportsOutputModel>(result => result
                                                 .Passing(model => model
                                                          .Reports.Count().Should().Be(10)));
Beispiel #9
0
        public void SearchShouldReturnAllApartmentAdsWithoutAQuery(int totalApartmentAds)
        => MyPipeline
        .Configuration()
        .ShouldMap("/ApartmentAds")

        .To <ApartmentAdsController>(c => c.Search(With.Empty <SearchApartmentAdsQuery>()))
        .Which(instance => instance
               .WithData(BrokerFakes.Data.GetBroker(totalApartmentAds: totalApartmentAds)))

        .ShouldReturn()
        .ActionResult <SearchApartmentAdsOutputModel>(result => result
                                                      .Passing(model => model
                                                               .ApartmentAds.Count().Should().Be(totalApartmentAds)));
Beispiel #10
0
 public void CreateShouldHaveRestrictionsForHttpPostOnly()
 => MyController <AddressesController>
 .Calling(c => c.Create(With.Empty <AddressesRequestModel>()))
 .ShouldHave()
 .ActionAttributes(attrs => attrs
                   .RestrictingForHttpMethod(HttpMethod.Post));