示例#1
0
		public static Configuration GetDefaultConfiguration()
		{
			var config = new Configuration("webpage");
			config.NewSetting(url, "");
			config.NewSetting(refresh_interval, "30");
			return config;
		}
示例#2
0
            public void Then_assure_Configuration_contians_Collection_setting()
            {
                configuration = new Configuration();
                configuration.NewSetting(GraphConfig.refrehInterval_setting_name, "0");
                configuration.NewSetting(GraphConfig.database_setting_name);

                this.ShouldThrowException<ArgumentException>(() =>
                    NewController());
            }
        public static List<Configuration> CreateConfiguration(bool isManuallyConfigured, DateTime endDate)
        {
            var _configuration = new Configuration("project-info");
            _configuration.NewSetting(WorkingDaysLeftController.SETTING_IS_MANUALLY_CONFIGURED, isManuallyConfigured ? "true" : "false");
            _configuration.NewSetting(WorkingDaysLeftController.SETTING_END_DATE, endDate.ToString(CultureInfo.InvariantCulture));
            _configuration.NewSetting(WorkingDaysLeftController.SETTING_SERVER, SERVER_NAME);
            _configuration.NewSetting(WorkingDaysLeftController.SETTING_PROJECT, PROJECT_NAME);
            _configuration.NewSetting(WorkingDaysLeftController.SETTING_NON_WORK_DAYS, "Saturday", "Sunday");

            return new List<Configuration> { _configuration };
        }
示例#4
0
            public void Then_assure_Configuration_contains_XAxisPropertyName()
            {
                configuration = new Configuration();
                configuration.NewSetting(GraphConfig.refrehInterval_setting_name, "5");
                configuration.NewSetting(GraphConfig.database_setting_name);
                configuration.NewSetting(GraphConfig.collection_setting_name);

                this.ShouldThrowException<ArgumentException>(() =>
                    NewController(), ex =>
                        ex.Message.ShouldBe("Config setting is missing; " + GraphConfig.xaxis_property_setting_name));
            }
示例#5
0
        private void MockRepository()
        {
            
            var config = new Configuration("Commit Statistics");
            config.NewSetting("timespan", "4");
            var fakeConfig = new List<Configuration> { config };

            configRepository = new Mock<IAsyncRepository<Configuration>>();
            configRepository.Setup(
                r => r.BeginGet(It.IsAny<Specification<Configuration>>())).Raises(
                t => t.GetCompleted += null, new GetCompletedEventArgs<Configuration>(fakeConfig, null));
        }
示例#6
0
 public void Setup()
 {
     configuration = new Configuration("source control");
     configuration.NewSetting("supported providers", "svn", "tfs", "clear case");
     configuration.NewSetting("selected provider", "svn");
 }
示例#7
0
        private static Configuration CreateConfiguration(bool firstName, bool surname, bool middlename, bool username, string userdbName)
        {
            var newConfig = new Configuration(SETTINGS_ENTRY_NAME);

            newConfig.NewSetting(FIRSTNAME_ENTRY_NAME, firstName.ToString());
            newConfig.NewSetting(SURNAME_ENTRY_NAME, surname.ToString());
            newConfig.NewSetting(MIDDLENAME_ENTRY_NAME, middlename.ToString());
            newConfig.NewSetting(USERNAME_ENTRY_NAME, username.ToString());
            newConfig.NewSetting(SELECTED_USERDB_ENTRY_NAME, userdbName);

            return newConfig;
        }
        public void Assure_existing_configuration_is_updated()
        {
            DeleteDatabaseIfExists();
            RecreateSessionFactory();
            var configuration = new Configuration("Name");
            configuration.Settings = new List<SettingsEntry>
                 {
                     new SettingsEntry("test", "Changed", "Changed")

                 };

            var dbRepo = new ConfigurationDatabaseRepository(sessionFactory);
            dbRepo.Save(configuration);

            configuration.Name = "newName";
            configuration.NewSetting("new", "value");


            RecreateSessionFactory();
            dbRepo = new ConfigurationDatabaseRepository(sessionFactory);

            dbRepo.Save(configuration);
                
            RecreateSessionFactory();
            dbRepo = new ConfigurationDatabaseRepository(sessionFactory);

            var result = dbRepo.Get(All.ItemsOf<Configuration>());

            result.Count().ShouldBe(1);
            AssertAreEqual(result.ElementAt(0), configuration);

        }
示例#9
0
        public void Assure_value_is_changed()
        {
            var configuration = new Configuration();
            configuration.NewSetting("hello", "world");
            configuration.ChangeSetting("hello", "moon");

            configuration.GetSetting("hello").Value.ShouldBe("moon");
        }
示例#10
0
文件: Shared.cs 项目: ArildF/Smeedee
 private static void SetupConfig(bool useEndDateFromConfig, DateTime endDate)
 {
     var nonWorkingDays = NoNonWorkingDays.Where(d => d.IsNotWorkingDay).Select(d => d.Day.ToString()).ToArray();
     
     config = new Configuration("project-info");
     config.IsConfigured = true;
     config.NewSetting(WorkingDaysLeftController.SETTING_IS_MANUALLY_CONFIGURED, useEndDateFromConfig ? "True" : "False");
     config.NewSetting(WorkingDaysLeftController.SETTING_END_DATE, endDate.ToString(CultureInfo.InvariantCulture));
     config.NewSetting(WorkingDaysLeftController.SETTING_NON_WORK_DAYS, nonWorkingDays);
 }
示例#11
0
 public static Configuration GetDefaultConfiguration()
 {
     var config = new Configuration(CONFIG_NAME);
     config.NewSetting(SETTING_IS_MANUALLY_CONFIGURED, "True");
     config.NewSetting(SETTING_END_DATE, DateTime.Now.AddDays(3).ToString(CultureInfo.InvariantCulture));
     config.NewSetting(SETTING_SERVER, "");
     config.NewSetting(SETTING_PROJECT, "");
     config.NewSetting(SETTING_NON_WORK_DAYS, new [] {"Saturday", "Sunday"});
     config.IsConfigured = false;
     return config;
 }
示例#12
0
        public static Configuration NewDefaultConfiguration()
        {
            var config = new Configuration("graph-config");
            config.NewSetting(refrehInterval_setting_name, "30000");
            config.NewSetting(database_setting_name);
            config.NewSetting(collection_setting_name);
            config.NewSetting(maxNrOfDataPoints_setting_name, "14");
            config.NewSetting(xaxis_property_setting_name);
            config.NewSetting(yaxis_property_Setting_name);
            config.IsConfigured = false;

            return config;
        }
示例#13
0
 private void CreateConfig()
 {
     _standardConfig = new Configuration();
     _standardConfig.NewSetting("IsDefault", "Yes");
 }
示例#14
0
			public void Then_assure_configuration_is_validated()
			{
				var invalidConfig = new Configuration("webpage");

				this.ShouldThrowException<ArgumentNullException>(() =>
					webPageController.UpdateConfiguration(null));

				this.ShouldThrowException<ArgumentException>(() =>
					webPageController.UpdateConfiguration(invalidConfig));

				invalidConfig.NewSetting("url", "");

				this.ShouldThrowException<ArgumentException>(() =>
					webPageController.UpdateConfiguration(invalidConfig));

				invalidConfig.ChangeSetting("refresh-interval", "a string");

				this.ShouldThrowException<ArgumentException>(() =>
					webPageController.UpdateConfiguration(invalidConfig));
			}
示例#15
0
 public void Setup()
 {
     configuration = new Configuration("source control");
     configuration.NewSetting("provider", "svn");
 }
示例#16
0
文件: Shared.cs 项目: ArildF/Smeedee
 private static void SetupCorruptConfig(string returnValue)
 {
     config = new Configuration("project-info");
     config.NewSetting("use-config-repo", returnValue);
     config.NewSetting("end-date", DateTime.Now.AddDays(3).ToString(new CultureInfo("en-US")));
 }
示例#17
0
 public void Setup()
 {
     configuration = new Configuration("source control");
     configuration.NewSetting("username", "goeran");
 }
示例#18
0
文件: Shared.cs 项目: ArildF/Smeedee
 private static void SetupConfigWithCorruptDateFormat(bool useConfigValues)
 {
     config = new Configuration("project-info");
     config.NewSetting("use-config-repo", useConfigValues ? "true" : "false");
     config.NewSetting("end-date", "epic fail");
 }
示例#19
0
        public void Setup()
        {
            configuration = new Configuration("source control");
            configuration.Id = Guid.NewGuid();
            configuration.NewSetting("supported providers", "svn", "tfs", "clear case");
            configuration.NewSetting("selected provider", "svn");
            configuration.IsConfigured = true;

            copy = configuration.Clone();
        }
        public void Assure_new_record_is_created()
        {
            Scenario.StartNew(this, scenario =>
            {
                Configuration configuration = null;

                scenario.Given(Database_exists).
                    And(Repository_is_created);

                scenario.When("a new Configuration is saved", () =>
                {
                    configuration = new Configuration()
                    {
                        Name = "ProcessManagement",
                    };
                    configuration.NewSetting("username", new string[] { "goeran" });
                    configurationRepository.Save(configuration);
                });

                scenario.Then("assure a new record is created in the Configuration database table", () =>
                {
                    var returnedConfig = sessionFactory.OpenSession().Get(typeof(Configuration), configuration.Id) as Configuration;
                    returnedConfig.ShouldNotBeNull();
                    returnedConfig.Name.ShouldBe("ProcessManagement");
                    (returnedConfig.Settings.Count() > 0).ShouldBeTrue();
                    var setting = returnedConfig.Settings.Where(s => s.Name == "username").SingleOrDefault();
                    setting.Name.ShouldBe("username");
                    (setting.Vals != null).ShouldBeTrue();
                    (setting.Vals.Count() > 0).ShouldBeTrue();
                    setting.Vals.AsEnumerable().FirstOrDefault().ShouldBe("goeran");
                });
            });
        }