示例#1
0
        public void WhenIDeleteAFeatureOverride_ThenTheFeatureOverrideIsRemovedAndSignalRClientsAreNotified()
        {
            var application = new Application {
                ApplicationId = 1, Name = "TestApplication1"
            };

            _createApplication.Execute(application);

            var feature = new Data.Entities.Feature {
                ApplicationId = application.ApplicationId, Name = "Feature1"
            };

            _createFeature.Execute(feature);

            var featureOverride = new Data.Entities.FeatureOverride {
                FeatureId = feature.FeatureId, Hostname = "Test", IsEnabled = true
            };

            _createFeatureOverride.Execute(featureOverride);

            _browser.Delete("/api/featureoverrides", with => { with.Query("id", "1"); });

            feature = _getFeature.Execute(feature.Name, application.Name);
            CollectionAssert.IsEmpty(feature.FeatureOverrides);

            _bootstrapper
            .Resolve <IMockClient>()
            .Received()
            .removeFeatureOverride(Arg.Any <dynamic>());
        }
示例#2
0
        public void WhenIPutAFeature_ThenTheFeatureOverrideIsUpdatedAndSignalRClientsAreNotified()
        {
            var application = new Application {
                ApplicationId = 1, Name = "TestApplication1"
            };

            _createApplication.Execute(application);

            var feature = new Data.Entities.Feature {
                ApplicationId = application.ApplicationId, Name = "Feature1"
            };

            _createFeature.Execute(feature);

            var featureOverride = new Data.Entities.FeatureOverride {
                FeatureId = feature.FeatureId, Hostname = "Test", IsEnabled = true
            };

            _createFeatureOverride.Execute(featureOverride);

            featureOverride.Hostname = "TEST123";

            Put(featureOverride.ToContract());

            feature = _getFeature.Execute(feature.Name, application.Name);
            Assert.That(feature.FeatureOverrides[0].Hostname, Is.EqualTo("TEST123"));

            _bootstrapper
            .Resolve <IMockClient>()
            .Received()
            .updateFeatureOverride(Arg.Any <dynamic>());
        }
        public void WhenIDeleteAFeatureOverride_ThenTheFeatureOverrideIsRemovedAndSignalRClientsAreNotified()
        {
            var application = new Application { ApplicationId = 1, Name = "TestApplication1" };
            _createApplication.Execute(application);

            var feature = new Data.Entities.Feature { ApplicationId = application.ApplicationId, Name = "Feature1" };
            _createFeature.Execute(feature);

            var featureOverride = new Data.Entities.FeatureOverride { FeatureId = feature.FeatureId, Hostname = "Test", IsEnabled = true };
            _createFeatureOverride.Execute(featureOverride);

            _browser.Delete("/api/featureoverrides", with => { with.Query("id", "1"); });

            feature = _getFeature.Execute(feature.Name, application.Name);
            CollectionAssert.IsEmpty(feature.FeatureOverrides);

            _bootstrapper
                .Resolve<IMockClient>()
                .Received()
                .removeFeatureOverride(Arg.Any<dynamic>());
        }
示例#4
0
 public void Execute(Data.Entities.FeatureOverride featureOverride)
 {
     using (var cnn = CreateConnection())
     {
         try
         {
             cnn.Execute(@"UPDATE FeatureOverride
                           SET IsEnabled = @IsEnabled, Hostname = @Hostname
                           WHERE FeatureOverrideId = @FeatureOverrideId", new
             {
                 featureOverride.IsEnabled,
                 featureOverride.Hostname,
                 featureOverride.FeatureOverrideId
             });
         }
         catch (DbException exception)
         {
             throw new UpdateFeatureOverrideException(exception);
         }
     }
 }
        public void WhenIPutAFeature_ThenTheFeatureOverrideIsUpdatedAndSignalRClientsAreNotified()
        {
            var application = new Application { ApplicationId = 1, Name = "TestApplication1" };
            _createApplication.Execute(application);

            var feature = new Data.Entities.Feature { ApplicationId = application.ApplicationId, Name = "Feature1" };
            _createFeature.Execute(feature);

            var featureOverride = new Data.Entities.FeatureOverride { FeatureId = feature.FeatureId, Hostname = "Test", IsEnabled = true };
            _createFeatureOverride.Execute(featureOverride);

            featureOverride.Hostname = "TEST123";

            Put(featureOverride.ToContract());

            feature = _getFeature.Execute(feature.Name, application.Name);
            Assert.That(feature.FeatureOverrides[0].Hostname, Is.EqualTo("TEST123"));

            _bootstrapper
                .Resolve<IMockClient>()
                .Received()
                .updateFeatureOverride(Arg.Any<dynamic>());
        }