/// <summary> /// Sets initial values to the <see cref="Microsoft.EntityFrameworkCore.DbContext"/> on the tested component. /// </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="entities"> /// Initial values to add to the registered <see cref="Microsoft.EntityFrameworkCore.DbContext"/>. /// </param> /// <returns>The same component builder.</returns> public static TBuilder WithData <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, IEnumerable <object> entities) where TBuilder : IBaseTestBuilder => builder .WithData(data => data .WithEntities(entities));
/// <summary> /// Sets an authenticated <see cref="Microsoft.AspNetCore.Http.HttpContext.User"/> to the /// built component with "TestId" identifier (Id) and the provided username and optional roles. /// </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="username"> /// Value of the username claim. Default claim type is <see cref="System.Security.Claims.ClaimTypes.Name"/>. /// </param> /// <param name="roles">Collection of role names to add.</param> /// <returns>The same component builder.</returns> public static TBuilder WithUser <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, string username, params string[] roles) where TBuilder : IBaseTestBuilder => builder .WithUser(username, roles.AsEnumerable());
/// <summary> /// Indicates that route values should be extracted from the provided action call expression adding the given additional values. /// </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="additionalRouteValues">Anonymous object containing route values.</param> /// <returns>The same component builder.</returns> public static TBuilder WithRouteData <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, object additionalRouteValues) where TBuilder : IBaseTestBuilder { var actualBuilder = (BaseTestBuilderWithComponentBuilder <TBuilder>)builder; actualBuilder.TestContext.PreMethodInvocationDelegate += () => { var testContext = actualBuilder.TestContext; if (testContext.RouteDataMethodCall != null) { testContext.RouteData = RouteExpressionParser.ResolveRouteData( TestApplication.Router, testContext.RouteDataMethodCall); } if (testContext.RouteData == null) { testContext.RouteData = new RouteData(); testContext.RouteData.Routers.Add(TestApplication.Router); } testContext.RouteData.Values.Add(additionalRouteValues); }; return(actualBuilder.Builder); }
/// <summary> /// Sets initial values to the <see cref="Microsoft.EntityFrameworkCore.DbContext"/> on the tested component. /// </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="entities"> /// Initial values to add to the registered <see cref="Microsoft.EntityFrameworkCore.DbContext"/>. /// </param> /// <returns>The same component builder.</returns> public static TBuilder WithData <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, params object[] entities) where TBuilder : IBaseTestBuilder => builder .WithData(data => data .WithEntities(entities));
/// <summary> /// Sets constructor services on the tested component. /// </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="services">Services to inject into the component constructor.</param> /// <returns>The same component builder.</returns> public static TBuilder WithServices <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, params object[] services) where TBuilder : IBaseTestBuilder { return(builder.WithServices(services.AsEnumerable())); }
/// <summary> /// Sets an authenticated <see cref="Microsoft.AspNetCore.Http.HttpContext.User"/> to the /// built component with "TestId" identifier (Id) and the provided username and roles. /// </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="roles">Collection of role names to add.</param> /// <returns>The same component builder.</returns> public static TBuilder WithUser <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, params string[] roles) where TBuilder : IBaseTestBuilder => builder .WithUser(user => user .InRoles(roles));
/// <summary> /// Remove entity from the <see cref="Microsoft.EntityFrameworkCore.DbContext"/> on the tested component. /// </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="entity"> /// Remove entity from the registered <see cref="Microsoft.EntityFrameworkCore.DbContext"/>. /// </param> /// <returns>The same component builder.</returns> public static TBuilder WithoutData <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, object entity) where TBuilder : IBaseTestBuilder => builder .WithoutData(data => data .WithoutEntity(entity));
/// <summary> /// Sets an authenticated <see cref="Microsoft.AspNetCore.Http.HttpContext.User"/> to the /// built component with "TestId" identifier (Id) and the provided username and roles. /// </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="username"> /// Value of the username claim. Default claim type is <see cref="System.Security.Claims.ClaimTypes.Name"/>. /// </param> /// <param name="roles">Collection of role names to add.</param> /// <returns>The same component builder.</returns> public static TBuilder WithUser <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, string username, IEnumerable <string> roles) where TBuilder : IBaseTestBuilder => builder .WithUser(user => user .WithUsername(username) .InRoles(roles));
/// <summary> /// Sets default authenticated <see cref="Microsoft.AspNetCore.Http.HttpContext.User"/> to the built component with "TestId" identifier and "TestUser" username. /// </summary> /// <typeparam name="TBuilder">Class representing ASP.NET Core MVC test builder.</typeparam> /// <param name="builder">Instance of <see cref="IBaseTestBuilderWithComponentBuilder{TBuilder}"/> type.</param> /// <returns>The same component builder.</returns> public static TBuilder WithAuthenticatedUser <TBuilder>(this IBaseTestBuilderWithComponentBuilder <TBuilder> builder) where TBuilder : IBaseTestBuilder { var actualBuilder = (BaseTestBuilderWithComponentBuilder <TBuilder>)builder; actualBuilder.HttpContext.User = ClaimsPrincipalBuilder.DefaultAuthenticated; return(actualBuilder.Builder); }
/// <summary> /// Sets initial values to the configuration options on the tested component. /// </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="optionsBuilder">Action setting the configuration options by using <see cref="IOptionsBuilder"/>.</param> /// <returns>The same component builder.</returns> public static TBuilder WithOptions <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, Action <IOptionsBuilder> optionsBuilder) where TBuilder : IBaseTestBuilder { var actualBuilder = (BaseTestBuilderWithComponentBuilder <TBuilder>)builder; optionsBuilder(new OptionsBuilder(actualBuilder.TestContext)); return(actualBuilder.Builder); }
/// <summary> /// Remove entity or entities from <see cref="Microsoft.Extensions.Caching.Memory.IMemoryCache"/> service. /// </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="memoryCacheBuilder">Action setting the <see cref="Microsoft.Extensions.Caching.Memory.IMemoryCache"/> values by using <see cref="IWithMemoryCacheBuilder"/>.</param> /// <returns>The same component builder.</returns> public static TBuilder WithoutMemoryCache <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, Action <IWithoutMemoryCacheBuilder> memoryCacheBuilder) where TBuilder : IBaseTestBuilder { var actualBuilder = (BaseTestBuilderWithComponentBuilder <TBuilder>)builder; memoryCacheBuilder(new WithoutMemoryCacheBuilder(actualBuilder.TestContext.HttpContext.RequestServices)); return(actualBuilder.Builder); }
/// <summary> /// Sets initial values to the HTTP <see cref="Microsoft.AspNetCore.Http.ISession"/>. /// </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="sessionBuilder">Action setting the <see cref="Microsoft.AspNetCore.Http.ISession"/> values by using <see cref="IWithSessionBuilder"/>.</param> /// <returns>The same component builder.</returns> public static TBuilder WithSession <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, Action <IWithSessionBuilder> sessionBuilder) where TBuilder : IBaseTestBuilder { var actualBuilder = (BaseTestBuilderWithComponentBuilder <TBuilder>)builder; sessionBuilder(new WithSessionBuilder(actualBuilder.TestContext.Session)); return(actualBuilder.Builder); }
/// <summary> /// Sets initial values to the <see cref="DbContext"/> on the tested component. /// </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="dbContextBuilder">Action setting the <see cref="DbContext"/> by using <see cref="IDbContextBuilder"/>.</param> /// <returns>The same component builder.</returns> public static TBuilder WithDbContext <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, Action <IDbContextBuilder> dbContextBuilder) where TBuilder : IBaseTestBuilder { var actualBuilder = (BaseTestBuilderWithComponentBuilder <TBuilder>)builder; dbContextBuilder(new DbContextBuilder(actualBuilder.TestContext)); return(actualBuilder.Builder); }
/// <summary> /// Sets services on the tested component. /// </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="servicesBuilder">Action setting the services by using <see cref="IServicesBuilder"/>.</param> /// <returns>The same component builder.</returns> public static TBuilder WithServices <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, Action <IServicesBuilder> servicesBuilder) where TBuilder : IBaseTestBuilder { var actualBuilder = (BaseTestBuilderWithComponentBuilder <TBuilder>)builder; servicesBuilder(new ServicesBuilder(actualBuilder.TestContext)); return(actualBuilder.Builder); }
/// <summary> /// Sets constructor services on the tested component. /// </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="services">Collection of service dependencies to inject into the component constructor.</param> /// <returns>The same component builder.</returns> public static TBuilder WithServices <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, IEnumerable <object> services) where TBuilder : IBaseTestBuilder { var actualBuilder = (BaseTestBuilderWithComponentBuilder <TBuilder>)builder; services.ForEach(service => actualBuilder.WithServices(serviceBuilder => serviceBuilder.With(service))); return(actualBuilder.Builder); }
/// <summary> /// Sets the <see cref="HttpContext"/> on the tested component. /// </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="httpContextSetup">Action setting the <see cref="HttpContext"/>.</param> /// <returns>The same component builder.</returns> public static TBuilder WithHttpContext <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, Action <HttpContext> httpContextSetup) where TBuilder : IBaseTestBuilder { var actualBuilder = (BaseTestBuilderWithComponentBuilder <TBuilder>)builder; httpContextSetup(actualBuilder.TestContext.HttpContext); return(actualBuilder.Builder); }
/// <summary> /// Sets initial values to the <see cref="Microsoft.Extensions.Caching.Distributed.IDistributedCache"/> service. /// </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="distributedCacheBuilder">Action setting the <see cref="Microsoft.Extensions.Caching.Distributed.IDistributedCache"/> values by using <see cref="IDistributedCacheBuilder"/>.</param> /// <returns>The same component builder.</returns> public static TBuilder WithDistributedCache <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, Action <IDistributedCacheBuilder> distributedCacheBuilder) where TBuilder : IBaseTestBuilder { var actualBuilder = (BaseTestBuilderWithComponentBuilder <TBuilder>)builder; distributedCacheBuilder(new DistributedCacheBuilder(actualBuilder.TestContext.HttpContext.RequestServices)); return(actualBuilder.Builder); }
public static TBuilder WithModelState <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, Action <IModelStateBuilder> modelStateTestBuilder) where TBuilder : IBaseTestBuilder { var actualBuilder = (BaseTestBuilderWithComponentBuilder <TBuilder>)builder; modelStateTestBuilder(new ModelStateBuilder(actualBuilder.TestContext as ActionTestContext)); return(actualBuilder.Builder); }
/// <summary> /// Sets the <see cref="HttpRequest"/> on the tested component. /// </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="httpRequest">Instance of <see cref="HttpRequest"/> to set.</param> /// <returns>The same component builder.</returns> public static TBuilder WithHttpRequest <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, HttpRequest httpRequest) where TBuilder : IBaseTestBuilder { CommonValidator.CheckForNullReference(httpRequest, nameof(HttpRequest)); var actualBuilder = (BaseTestBuilderWithComponentBuilder <TBuilder>)builder; actualBuilder.TestContext.HttpContextMock.CustomRequest = httpRequest; return(actualBuilder.Builder); }
/// <summary> /// Sets initial values to the <see cref="Microsoft.AspNetCore.Mvc.ViewFeatures.TempDataDictionary"/> on the tested component. /// </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="tempDataBuilder">Action setting the <see cref="Microsoft.AspNetCore.Mvc.ViewFeatures.TempDataDictionary"/> values by using <see cref="ITempDataBuilder"/>.</param> /// <returns>The same component builder.</returns> public static TBuilder WithTempData <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, Action <ITempDataBuilder> tempDataBuilder) where TBuilder : IBaseTestBuilder { var actualBuilder = (BaseTestBuilderWithComponentBuilder <TBuilder>)builder; actualBuilder.TestContext.ComponentPreparationDelegate += () => { tempDataBuilder(new TempDataBuilder(actualBuilder.TestContext.GetTempData())); }; return(actualBuilder.Builder); }
/// <summary> /// Sets constructor service dependencies on the tested component. /// </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="dependencies">Collection of service dependencies to inject into the component constructor.</param> /// <returns>The same component builder.</returns> public static TBuilder WithDependencies <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, IEnumerable <object> dependencies) where TBuilder : IBaseTestBuilder { var actualBuilder = (BaseTestBuilderWithComponentBuilder <TBuilder>)builder; dependencies .ForEach(dependency => actualBuilder .WithDependencies(dependenciesBuilder => dependenciesBuilder .With(dependency))); return(actualBuilder.Builder); }
/// <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); }
/// <summary> /// Sets custom authenticated <see cref="Microsoft.AspNetCore.Http.HttpContext.User"/> to the built component using the provided user builder. /// </summary> /// <param name="builder">Instance of <see cref="IBaseTestBuilderWithComponentBuilder{TBuilder}"/> type.</param> /// <param name="userBuilder">Action setting the <see cref="Microsoft.AspNetCore.Http.HttpContext.User"/> by using <see cref="IClaimsPrincipalBuilder"/>.</param> /// <returns>The same component builder.</returns> public static TBuilder WithAuthenticatedUser <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, Action <IClaimsPrincipalBuilder> userBuilder) where TBuilder : IBaseTestBuilder { var actualBuilder = (BaseTestBuilderWithComponentBuilder <TBuilder>)builder; var newUserBuilder = new ClaimsPrincipalBuilder(); userBuilder(newUserBuilder); actualBuilder.HttpContext.User = newUserBuilder.GetClaimsPrincipal(); return(actualBuilder.Builder); }
/// <summary> /// Sets constructor service dependencies on the tested component. /// </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="dependencies">Service dependencies to inject into the component constructor.</param> /// <returns>The same component builder.</returns> public static TBuilder WithDependencies <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, params object[] dependencies) where TBuilder : IBaseTestBuilder => builder .WithDependencies(dependencies.AsEnumerable());
/// <summary> /// Remove given entities from <see cref="Microsoft.Extensions.Caching.Memory.IMemoryCache"/> service. /// </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="keys">Keys of the entities that will be removed.</param> /// <returns>The same component builder.</returns> public static TBuilder WithoutMemoryCache <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, params object[] keys) where TBuilder : IBaseTestBuilder => builder.WithoutMemoryCache(cache => cache.WithoutEntries(keys));
/// <summary> /// Indicates that route values should be extracted from the provided method call expression. /// </summary> /// <typeparam name="TBuilder">Class representing ASP.NET Core MVC test builder.</typeparam> /// <param name="builder">Instance of <see cref="IBaseTestBuilderWithComponentBuilder{TBuilder}"/> type.</param> /// <returns>The same component builder.</returns> public static TBuilder WithRouteData <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder) where TBuilder : IBaseTestBuilder => builder .WithRouteData(null);
/// <summary> /// Remove collection of session key entries from the HTTP <see cref="Microsoft.AspNetCore.Http.ISession"/>. /// </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="keys">Session key entries to remove.</param> /// <returns>The same component builder.</returns> public static TBuilder WithoutSession <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, params string[] keys) where TBuilder : IBaseTestBuilder => builder.WithoutSession(session => session.WithoutEntries(keys));
/// <summary> /// Remove collection of session key entries from the HTTP <see cref="Microsoft.AspNetCore.Http.ISession"/>. /// </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="keys">Session key entries to remove.</param> /// <returns>The same component builder.</returns> public static TBuilder WithoutSession <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, IEnumerable <string> keys) where TBuilder : IBaseTestBuilder => builder.WithoutSession(session => session.WithoutEntries(keys));
/// <summary> /// Clear all entities from <see cref="Microsoft.Extensions.Caching.Memory.IMemoryCache"/> service. /// </summary> /// <typeparam name="TBuilder">Class representing ASP.NET Core MVC test builder.</typeparam> /// <param name="builder">Instance of <see cref="IBaseTestBuilderWithComponentBuilder{TBuilder}"/> type.</param> /// <returns>The same component builder.</returns> public static TBuilder WithoutMemoryCache <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder) where TBuilder : IBaseTestBuilder => builder.WithoutMemoryCache(cache => cache.WithoutAllEntries());
/// <summary> /// Remove given entity with key from <see cref="Microsoft.Extensions.Caching.Memory.IMemoryCache"/> service. /// </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="key">Key of the entity that will be removed.</param> /// <returns>The same component builder.</returns> public static TBuilder WithoutMemoryCache <TBuilder>( this IBaseTestBuilderWithComponentBuilder <TBuilder> builder, object key) where TBuilder : IBaseTestBuilder => builder.WithoutMemoryCache(cache => cache.WithoutEntry(key));