Example #1
0
        public async Task Set_SetsExpectedFeature()
        {
            var client = factory.CreateClient();
            await client.GetAsync("/"); // Invoke Initialize of IFeatureProvider

            var provider = TestStartup.Options.Provider;

            var feature = new TestFeature
            {
                Value = true
            };

            var response = await client.PostAsync(
                TestStartup.Options.ApiSetPath,
                new StringContent(JsonConvert.SerializeObject(
                                      new FeatureSetRequest
            {
                Feature = feature.GetType().Name,
                Value = true
            })));

            response.EnsureSuccessStatusCode();

            var providerFeature = await provider.Get(typeof(TestFeature).Name);

            Assert.True(providerFeature.Value);
        }
Example #2
0
        public async Task Get_ReturnsExpectedFeature()
        {
            var client = factory.CreateClient();
            await client.GetAsync("/"); // Invoke Initialize of IFeatureProvider

            var testFeature = new TestFeature
            {
                Value = true
            };

            await TestStartup.Options.Provider.Set(testFeature);

            var response = await client.GetAsync(
                $"{TestStartup.Options.ApiGetPath}?feature={testFeature.GetType().Name}");

            response.EnsureSuccessStatusCode();

            var feature = await response.Content.ReadAsJson <TestFeature>();

            Assert.True(feature.Value);
        }