Beispiel #1
0
        public async Task Should_dispose_feature_when_they_implement_IDisposable()
        {
            var feature = new FeatureWithStartupTaskWhichIsDisposable();

            featureSettings.Add(feature);

            var builder = new FakeBuilder(typeof(FeatureWithStartupTaskWhichIsDisposable.Runner));

            featureSettings.SetupFeatures(null, null);

            await featureSettings.StartFeatures(builder, null);

            await featureSettings.StopFeatures(null);

            Assert.True(FeatureWithStartupTaskWhichIsDisposable.Runner.Disposed);
        }
Beispiel #2
0
        public async Task Should_start_and_stop_features()
        {
            var feature = new FeatureWithStartupTask();

            featureSettings.Add(feature);

            var builder = new FakeBuilder(typeof(FeatureWithStartupTask.Runner));

            featureSettings.SetupFeatures(null, null);

            await featureSettings.StartFeatures(builder, null);

            await featureSettings.StopFeatures(null);

            Assert.True(FeatureWithStartupTask.Runner.Started);
            Assert.True(FeatureWithStartupTask.Runner.Stopped);
        }
        public void Should_not_activate_features_with_unmet_dependencies()
        {
            var feature = new FeatureWithStartupTask();

            var featureSettings = new FeatureActivator(new SettingsHolder());

            featureSettings.Add(feature);

            var builder = new FakeBuilder(typeof(FeatureWithStartupTask.Runner));

            featureSettings.SetupFeatures(new FeatureConfigurationContext(null));

            featureSettings.StartFeatures(builder);
            featureSettings.StopFeatures(builder);

            Assert.True(FeatureWithStartupTask.Runner.Started);
            Assert.True(FeatureWithStartupTask.Runner.Stopped);
        }