public void FluentControllerBuilder_FluentActionWithModelStateReturnsString()
 {
     BuilderTestUtils.BuildActionAndCompareToStaticAction(
         new FluentAction("/route/url", HttpMethod.Post)
         .UsingModelState()
         .To(modelState => $"Hello World!"),
         typeof(ControllerWithModelStateReturnsString));
 }
 public void FluentControllerBuilder_FluentActionWithModelStateReturnsStringAsync()
 {
     BuilderTestUtils.BuildActionAndCompareToStaticAction(
         new FluentAction("/route/url", HttpMethod.Post)
         .UsingModelState()
         .To(async modelState => { await Task.Delay(1); return($"Hello World!"); }),
         typeof(ControllerWithModelStateReturnsStringAsync));
 }
 public void FluentControllerBuilder_FluentActionUsing2FormFilesReturnsString()
 {
     BuilderTestUtils.BuildActionAndCompareToStaticAction(
         new FluentAction("/route/url", HttpMethod.Post)
         .UsingFormFiles("files")
         .To(files => $"Got {files.Count()} n.o. files!"),
         typeof(ControllerWith2FormFilesReturnsString));
 }
 public void FluentControllerBuilder_FluentActionUsing2FormFilesReturnsStringAsync()
 {
     BuilderTestUtils.BuildActionAndCompareToStaticAction(
         new FluentAction("/route/url", HttpMethod.Post)
         .UsingFormFiles("files")
         .To(async files => { await Task.Delay(1); return($"Got {files.Count()} n.o. files!"); }),
         typeof(ControllerWith2FormFilesReturnsStringAsync));
 }
 public void FluentControllerBuilder_FluentActionUsingFormFileReturnsStringAsync()
 {
     BuilderTestUtils.BuildActionAndCompareToStaticAction(
         new FluentAction("/route/url", HttpMethod.Post)
         .UsingFormFile("file")
         .To(async file => { await Task.Delay(1); return($"Got file with name {file.FileName}!"); }),
         typeof(ControllerWithFormFileReturnsStringAsync));
 }
 public void FluentControllerBuilder_FluentActionUsingFormFileReturnsString()
 {
     BuilderTestUtils.BuildActionAndCompareToStaticAction(
         new FluentAction("/route/url", HttpMethod.Post)
         .UsingFormFile("file")
         .To(file => $"Got file with name {file.FileName}!"),
         typeof(ControllerWithFormFileReturnsString));
 }
Beispiel #7
0
 public void FluentControllerBuilder_FluentActionWithAntiForgeryTokenReturnsStringAsync()
 {
     BuilderTestUtils.BuildActionAndCompareToStaticAction(
         new FluentAction("/route/url", HttpMethod.Post)
         .ValidateAntiForgeryToken()
         .To(async() => { await Task.Delay(1); return($"Hello World!"); }),
         typeof(ControllerWithAntiForgeryTokenReturnsStringAsync));
 }
Beispiel #8
0
 public void FluentControllerBuilder_FluentActionWithAntiForgeryTokenReturnsString()
 {
     BuilderTestUtils.BuildActionAndCompareToStaticAction(
         new FluentAction("/route/url", HttpMethod.Post)
         .ValidateAntiForgeryToken()
         .To(() => $"Hello World!"),
         typeof(ControllerWithAntiForgeryTokenReturnsString));
 }
Beispiel #9
0
 public void FluentControllerBuilder_FluentActionForReadMeExample2()
 {
     BuilderTestUtils.BuildActionAndCompareToStaticAction(
         new FluentAction("/users/{userId}", HttpMethod.Get)
         .UsingService <IUserService>()
         .UsingRouteParameter <int>("userId")
         .To((userService, userId) => userService.GetUserById(userId))
         .ToView("~/Views/Users/DisplayUser.cshtml"),
         typeof(ControllerForReadMeExample2));
 }