示例#1
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"));
        }
 public void SetUp()
 {
     _createConfiguration = new CreateConfigurationFake();
     _createApplication = new CreateApplicationFake();
     _deleteConfiguration = new DeleteConfiguration();
     _getConfigurationByNameAndApplication = new GetConfigurationByNameAndApplication();
     Runner.SqlCompact("Lemonade").Down();
     Runner.SqlCompact("Lemonade").Up();
 }
示例#3
0
 public void SetUp()
 {
     _createFeature = new CreateFeatureFake();
     _createApplication = new CreateApplicationFake();
     _deleteFeature = new DeleteFeature();
     _getApplicationByName = new GetApplicationByName();
     _getFeatureByNameAndApplication = new GetFeatureByNameAndApplication();
     Runner.SqlCompact("Lemonade").Down();
     Runner.SqlCompact("Lemonade").Up();
 }
        public void WhenITryToSaveADuplicateApplication_ThenSaveApplicationExceptionIsThrown()
        {
            var saveApplication = new CreateApplicationFake();
            var application = new ApplicationBuilder()
                .WithName("Test12345")
                .Build();

            saveApplication.Execute(application);

            Assert.Throws<CreateApplicationException>(() => saveApplication.Execute(application));
        }
示例#5
0
        public void SetUp()
        {
            _createApplication = new CreateApplicationFake();
            _getApplication = new GetApplicationByName();
            _getFeature = new GetFeatureByNameAndApplication();
            _server = new Server(64978);
            _testBootstrapper = new TestBootstrapper();
            _browser = new Browser(_testBootstrapper, context => context.UserHostAddress("localhost"));

            Runner.SqlCompact(ConnectionString).Down();
            Runner.SqlCompact(ConnectionString).Up();
        }
        public void WhenISaveAnApplication_ThenICanRetrieveIt()
        {
            var saveApplication = new CreateApplicationFake();
            var getApplicationByName = new GetApplicationByName();
            saveApplication.Execute(new ApplicationBuilder()
                .WithName("Test12345")
                .Build());

            var application = getApplicationByName.Execute("Test12345");
            Assert.That(application, Is.Not.Null);
            Assert.That(application.Name, Is.EqualTo("Test12345"));
        }
示例#7
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));
        }
        public void WhenITryToSaveADuplicateConfiguration_ThenSaveConfigurationExceptionIsThrown()
        {
            var saveConfiguration = new CreateConfigurationFake();
            var saveApplication = new CreateApplicationFake();
            var getApplicationByName = new GetApplicationByName();

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

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

            var configuration = new ConfigurationBuilder()
                .WithName("MyTestFeature")
                .WithValue("Hello World")
                .WithApplication(application).Build();

            saveConfiguration.Execute(configuration);

            Assert.Throws<CreateConfigurationException>(() => saveConfiguration.Execute(configuration));
        }