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

            Configuration.ConfigurationResolver = new HttpConfigurationResolver("http://localhost:12345");
            Runner.SqlCompact("Lemonade").Down();
            Runner.SqlCompact("Lemonade").Up();

            new CreateApplicationFake().Execute(application);
            _application = new GetApplicationByName().Execute(application.Name);

            _nancyHost = new NancyHost(new Uri("http://localhost:12345"), new LemonadeBootstrapper());
            _nancyHost.Start();
        }
Пример #2
0
 public void Execute(Application application)
 {
     using (var cnn = CreateConnection())
     {
         try
         {
             cnn.Execute("INSERT INTO Application (Name) VALUES (@Name)", new { application.Name });
             application.ApplicationId = cnn.Query<int>("SELECT CAST(@@IDENTITY AS INT)").First();
         }
         catch (DbException exception)
         {
             throw new CreateApplicationException(exception);
         }
     }
 }
Пример #3
0
 public void Execute(Application application)
 {
     using (var cnn = CreateConnection())
     {
         try
         {
             application.ApplicationId = cnn.Query<int>(@"INSERT INTO Application (Name) VALUES (@Name);
                                                          SELECT SCOPE_IDENTITY();", new { application.Name }).First();
         }
         catch (DbException exception)
         {
             throw new CreateApplicationException(exception);
         }
     }
 }
        public void WhenISaveAFeatureOverride_ThenTheFeatureOverrideIsSaved()
        {
            var application = new Application { Name = "Test" };
            new CreateApplicationFake().Execute(application);

            var feature = new Feature { Name = "Test", ApplicationId = application.ApplicationId };
            new CreateFeatureFake().Execute(feature);

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

            var features = new GetAllFeaturesByApplicationId().Execute(application.ApplicationId);

            Assert.That(features[0].FeatureOverrides[0].Hostname, Is.EqualTo("Test"));
            Assert.That(features[0].FeatureOverrides[0].IsEnabled, Is.True);
        }
Пример #5
0
 public void Execute(Application application)
 {
     using (var cnn = CreateConnection())
     {
         try
         {
             cnn.Execute(@"UPDATE Application SET Name = @Name WHERE ApplicationId = @ApplicationId", new
             {
                 application.Name,
                 application.ApplicationId
             });
         }
         catch (DbException exception)
         {
             throw new UpdateApplicationException(exception);
         }
     }
 }
Пример #6
0
 public ConfigurationBuilder WithApplication(Application application)
 {
     _configuration.Application = application;
     _configuration.ApplicationId = application.ApplicationId;
     return this;
 }
Пример #7
0
 public ResourceBuilder WithApplication(Application application)
 {
     _resource.ApplicationId = application.ApplicationId;
     _resource.Application = application;
     return this;
 }
Пример #8
0
 public ApplicationBuilder()
 {
     _application = new Application();
 }
Пример #9
0
 public FeatureBuilder WithApplication(Application application)
 {
     _feature.ApplicationId = application.ApplicationId;
     _feature.Application = application;
     return this;
 }