public UnleashServiceFixture()
        {
            Settings = new UnleashSettings
            {
                UnleashApi  = new Uri("http://localhost:4242/"),
                AppName     = "IntegrationTest",
                InstanceTag = "Test"
            };

            UnleashServices = new DefaultUnleashServices(Settings);
            ContextProvider = new DefaultUnleashContextProvider();
            Unleash         = new Unleash(Settings, UnleashServices, ContextProvider);

            UnleashServices?.FeatureToggleLoadComplete(false, CancellationToken.None).Wait();

            var httpClient = new HttpClient
            {
                BaseAddress = new Uri("http://localhost:4242/admin/")
            };

            httpClient.DefaultRequestHeaders.ConnectionClose = false;
            httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Accept", "application/json");
            httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
            httpClient.DefaultRequestHeaders.CacheControl = new CacheControlHeaderValue {
                NoCache = true
            };

            var jsonSerializerSettings = new NewtonsoftJsonSerializerSettings();

            JsonSerializer = new NewtonsoftJsonSerializer(jsonSerializerSettings);
            AdminApiClient = new UnleashAdminApiClient(httpClient, JsonSerializer);
        }
Пример #2
0
        protected BaseUnleashApiClientIntegrationTests()
        {
            var apiUri = new Uri("http://localhost:4242/");

            var jsonSerializer = new NewtonsoftJsonSerializer(new NewtonsoftJsonSerializerSettings());

            var httpClientFactory = new DefaultHttpClientFactory();

            var requestHeaders = new UnleashApiClientRequestHeaders
            {
                AppName           = "api-test-client",
                InstanceTag       = "instance1",
                CustomHttpHeaders = null
            };

            var httpClient = httpClientFactory.Create(apiUri);

            Client      = new UnleashApiClient(httpClient, jsonSerializer, requestHeaders);
            AdminClient = new UnleashAdminApiClient(httpClient, jsonSerializer);
        }
Пример #3
0
 public HomeController(IUnleashAdminApiClient adminApiClient)
 {
     AdminApiClient = adminApiClient;
 }