/// <inheritdoc /> public IShouldMapTestBuilder ShouldMap(Action<IHttpRequestBuilder> httpRequestBuilder) { var httpBuilder = new HttpRequestBuilder(this.HttpContext); httpRequestBuilder(httpBuilder); httpBuilder.ApplyTo(this.HttpContext.Request); return this.ShouldMap(this.HttpContext); }
/// <inheritdoc /> public IShouldMapTestBuilder ShouldMap(Action <IHttpRequestBuilder> httpRequestBuilder) { var httpBuilder = new HttpRequestBuilder(); httpRequestBuilder(httpBuilder); httpBuilder.ApplyTo(this.HttpContext.Request); return(this.ShouldMap(this.HttpContext)); }
/// <inheritdoc /> public IAndControllerBuilder <TController> WithHttpRequest(Action <IHttpRequestBuilder> httpRequestBuilder) { var newHttpRequestBuilder = new HttpRequestBuilder(this.HttpContext); httpRequestBuilder(newHttpRequestBuilder); newHttpRequestBuilder.ApplyTo(this.HttpRequest); return(this); }
/// <summary> /// Sets the <see cref="HttpRequest"/> on the tested controller. /// </summary> /// <typeparam name="TBuilder">Class representing ASP.NET Core MVC test builder.</typeparam> /// <param name="builder">Instance of <see cref="IBaseTestBuilderWithComponentBuilder{TBuilder}"/> type.</param> /// <param name="httpRequestBuilder">Action setting the <see cref="HttpRequest"/> by using <see cref="IHttpRequestBuilder"/>.</param> /// <returns>The same component builder.</returns> public static TBuilder WithHttpRequest <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, Action <IHttpRequestBuilder> httpRequestBuilder) where TBuilder : IBaseTestBuilder { var actualBuilder = (BaseTestBuilderWithComponentBuilder <TBuilder>)builder; var newHttpRequestBuilder = new HttpRequestBuilder(actualBuilder.HttpContext); httpRequestBuilder(newHttpRequestBuilder); newHttpRequestBuilder.ApplyTo(actualBuilder.HttpContext.Request); return(actualBuilder.Builder); }