public void SetUp()
        {
            var application = new ApplicationBuilder().WithName("Test Application").Build();

            Configuration.FeatureResolver = new HttpFeatureResolver("http://localhost:12345");
            Runner.SqlCompact("Lemonade").Down();
            Runner.SqlCompact("Lemonade").Up();
            _getFeature           = new GetFeatureByNameAndApplication();
            _createFeature        = new CreateFeatureFake();
            _createApplication    = new CreateApplicationFake();
            _getApplicationByName = new GetApplicationByName();
            _createApplication.Execute(application);
            application = _getApplicationByName.Execute(application.Name);

            var feature1 = new FeatureBuilder().WithName("MySuperDuperFeature")
                           .WithApplication(application)
                           .WithIsEnabled(true)
                           .Build();

            var feature2 = new FeatureBuilder().WithName("Ponies")
                           .WithApplication(application)
                           .WithIsEnabled(true)
                           .Build();

            _createFeature.Execute(feature1);
            _createFeature.Execute(feature2);

            new CreateFeatureOverrideFake().Execute(new Data.Entities.FeatureOverride {
                FeatureId = feature2.FeatureId, Hostname = Dns.GetHostName(), IsEnabled = true
            });
            _nancyHost = new NancyHost(new Uri("http://localhost:12345"), new LemonadeBootstrapper());
            _nancyHost.Start();
        }
示例#2
0
        public void WhenITryToSaveAFeature_ThenFeatureHasBeenSavedEventIsRaisedWithCorrectDetails()
        {
            var saveFeature                    = new CreateFeatureFake();
            var updateFeature                  = new UpdateFeature();
            var saveApplication                = new CreateApplicationFake();
            var getApplicationByName           = new GetApplicationByName();
            var getFeatureByNameAndApplication = new GetFeatureByNameAndApplication();

            var application = new ApplicationBuilder()
                              .WithName("Test12345")
                              .Build();

            saveApplication.Execute(application);
            application = getApplicationByName.Execute(application.Name);

            var feature = new FeatureBuilder()
                          .WithName("MyTestFeature")
                          .WithApplication(application).Build();

            saveFeature.Execute(feature);
            feature      = getFeatureByNameAndApplication.Execute(feature.Name, application.Name);
            feature.Name = "Ponies";
            updateFeature.Execute(feature);

            feature = getFeatureByNameAndApplication.Execute(feature.Name, application.Name);

            Assert.That(feature.Name, Is.EqualTo("Ponies"));
        }
示例#3
0
 public void SetUp()
 {
     _createFeature        = new CreateFeatureFake();
     _createApplication    = new CreateApplicationFake();
     _deleteApplication    = new DeleteApplication();
     _getApplicationByName = new GetApplicationByName();
     Runner.SqlCompact("Lemonade").Down();
     Runner.SqlCompact("Lemonade").Up();
 }
示例#4
0
        public void SetUp()
        {
            _getFeature            = new GetFeatureByNameAndApplication();
            _createApplication     = new CreateApplicationFake();
            _createFeature         = new CreateFeatureFake();
            _createFeatureOverride = new CreateFeatureOverrideFake();
            _server = new Server(64978);

            Runner.SqlCompact(ConnectionString).Down();
            Runner.SqlCompact(ConnectionString).Up();

            _bootstrapper = new TestBootstrapper();
            _browser      = new Browser(_bootstrapper, context => context.UserHostAddress("localhost"));
        }
示例#5
0
        public void WhenITryToSaveADuplicateFeature_ThenSaveFeatureExceptionIsThrown()
        {
            var saveFeature          = new CreateFeatureFake();
            var saveApplication      = new CreateApplicationFake();
            var getApplicationByName = new GetApplicationByName();

            var application = new ApplicationBuilder()
                              .WithName("Test12345")
                              .Build();

            saveApplication.Execute(application);
            application = getApplicationByName.Execute(application.Name);

            var feature = new FeatureBuilder()
                          .WithName("MyTestFeature")
                          .WithApplication(application).Build();

            saveFeature.Execute(feature);

            Assert.Throws <CreateFeatureException>(() => saveFeature.Execute(feature));
        }