Ejemplo n.º 1
0
        public async Task GetAll_ReturnsExpectedFeatures()
        {
            var client = factory.CreateClient();
            await client.GetAsync("/"); // Invoke Initialize of IFeatureProvider

            var testFeature = new TestFeature
            {
                Value = true
            };

            var testFeature2 = new TestFeature2
            {
                Value = true
            };

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

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

            var response = await client.GetAsync(TestStartup.Options.ApiGetAllPath);

            response.EnsureSuccessStatusCode();

            // Technically not a valid type for TestFeature2:
            var features = await response.Content.ReadAsJson <IEnumerable <TestFeature> >();

            Assert.Equal(2, features.Count());

            Assert.All(features, feature => Assert.True(feature.Value));
        }
Ejemplo n.º 2
0
        public void TestFeature2_has_correct_description()
        {
            var feature = new TestFeature2();

            Assert.Equal("Test feature 2 description.", feature.Description);
        }
Ejemplo n.º 3
0
        public void TestFeature2_has_correct_name()
        {
            var feature = new TestFeature2();

            Assert.Equal("TestFeature2", feature.Name);
        }