public static Testing.Commons.ServiceStack.v3.HostTesterBase DisableAuthentication(this Testing.Commons.ServiceStack.v3.HostTesterBase tester) { var authenticator = Substitute.For <IApiAuthenticator>(); tester.Replacing(authenticator); return(tester); }
public static Testing.Commons.ServiceStack.v3.HostTesterBase FullThrottle(this Testing.Commons.ServiceStack.v3.HostTesterBase tester) { var throttler = Substitute.For <IRequestThrottler>(); tester.Replacing(throttler); return(tester); }
public static Testing.Commons.ServiceStack.v3.HostTesterBase DisableEnforcer(this Testing.Commons.ServiceStack.v3.HostTesterBase tester) { var enforcer = Substitute.For <IHttpsEnforcer>(); tester.Replacing(enforcer); return(tester); }
public static IRequestCountRepository SetupThrottling(this Testing.Commons.ServiceStack.v3.HostTesterBase tester, ushort numberOfRequests, TimeSpan period, RequestCount count = null) { var configuration = new ThrottlingConfiguration { NumberOfRequests = numberOfRequests, Period = period }; var manager = Substitute.For <IResourceManager>(); manager.Get(ThrottlingConfiguration.Key, Arg.Any <ThrottlingConfiguration>()) .Returns(configuration); tester.Replacing(manager); var repository = Substitute.For <IRequestCountRepository>(); if (count != null) { repository.Get(Arg.Any <ApiKey>()).Returns(count); } tester.Replacing(repository); return(repository); }
public static void Throttle(this Testing.Commons.ServiceStack.v3.HostTesterBase tester, ushort numberOfRequests, TimeSpan period) { var configuration = new ThrottlingConfiguration { NumberOfRequests = numberOfRequests, Period = period }; var manager = Substitute.For <IResourceManager>(); manager.Get(ThrottlingConfiguration.Key, Arg.Any <ThrottlingConfiguration>()) .Returns(configuration); tester.Replacing(manager); }