Exemplo n.º 1
0
        public void ShouldBeAbleToUseProfigurationSetToNameProfigurations()
        {
            DirectoryInfo    dir        = new DirectoryInfo(MethodBase.GetCurrentMethod().Name);
            ProfigurationSet profSet    = new ProfigurationSet(dir);
            string           randomName = "Test_".RandomLetters(4);
            Profiguration    prof       = profSet.Get(randomName);

            Expect.IsNotNull(prof);
            Expect.IsTrue(File.Exists(Path.Combine(dir.FullName, randomName)));
            Expect.IsTrue(File.Exists(Path.Combine(dir.FullName, randomName + ".key")));
        }
Exemplo n.º 2
0
        public void SettingAProfigurationValueShouldReflectImmediately()
        {
            DirectoryInfo    dir   = new DirectoryInfo(MethodBase.GetCurrentMethod().Name);
            ProfigurationSet set   = new ProfigurationSet(dir);
            string           name  = "Test_".RandomLetters(6);
            string           key   = "Key_".RandomLetters(4);
            string           value = "Value_".RandomLetters(4);

            Profiguration prof = set[name];

            prof.AppSettings[key] = value;

            Expect.AreEqual(value, prof.AppSettings[key], "value didn't get set");
        }
Exemplo n.º 3
0
        public void ShouldBeAbleToSaveAProfigurationProvidingAName()
        {
            DirectoryInfo    dir        = new DirectoryInfo(MethodBase.GetCurrentMethod().Name);
            ProfigurationSet set        = new ProfigurationSet(dir);
            string           randomName = "Test_".RandomLetters(4);
            Profiguration    prof       = new Profiguration();

            prof.AppSettings["test"] = "monkey";

            set.Save(randomName, prof);

            Expect.IsTrue(File.Exists(Path.Combine(dir.FullName, randomName)));
            Expect.IsTrue(File.Exists(Path.Combine(dir.FullName, randomName + ".key")));

            Profiguration verify = set.Get(randomName);

            Expect.AreEqual("monkey", verify.AppSettings["test"]);
        }
Exemplo n.º 4
0
        public void ShouldBeAbleToUseIndexedProfiguration()
        {
            DirectoryInfo    dir   = new DirectoryInfo(MethodBase.GetCurrentMethod().Name);
            ProfigurationSet set   = new ProfigurationSet(dir);
            string           name  = "Test_".RandomLetters(6);
            string           key   = "Key_".RandomLetters(4);
            string           value = "Value_".RandomLetters(4);

            Profiguration prof = set[name];

            prof.AppSettings[key] = value;

            Expect.AreEqual(value, prof.AppSettings[key], "value didn't get set");

            set.Save();

            ProfigurationSet validate = new ProfigurationSet(dir);

            Expect.AreEqual(value, validate[name].AppSettings[key]);
        }
Exemplo n.º 5
0
        public void IndexedProfigurationShouldAddName()
        {
            DirectoryInfo dir = new DirectoryInfo(MethodBase.GetCurrentMethod().Name);

            if (dir.Exists)
            {
                dir.Delete(true);
            }

            ProfigurationSet set   = new ProfigurationSet(dir);
            string           name  = "Test_".RandomLetters(6);
            string           key   = "Key_".RandomLetters(4);
            string           value = "Value_".RandomLetters(4);

            Expect.IsTrue(set.ProfigurationNames.Length == 0);

            Profiguration prof = set[name];

            Expect.IsTrue(set.ProfigurationNames.Length == 1);
        }
Exemplo n.º 6
0
 public JobManagerService(IApplicationNameProvider appNameProvider, DataSettings dataSettings, ProfigurationSet profiguration = null)
 {
     TypeResolver            = new TypeResolver();
     DataSettings            = dataSettings;
     ApplicationNameProvider = appNameProvider;
     JobsDirectory           = dataSettings.GetAppDataDirectory(appNameProvider, "Jobs").FullName;
     ProfigurationSet        = profiguration ?? new ProfigurationSet(System.IO.Path.Combine(JobsDirectory, "ProfigurationSet"));
     MaxConcurrentJobs       = 3;
     _enqueueSignal          = new AutoResetEvent(false);
     _runCompleteSignal      = new AutoResetEvent(false);
 }