public void SunnyDay()
        {
            StaticApplicationContext ac = new StaticApplicationContext();

            MutablePropertyValues pvs = new MutablePropertyValues();

            pvs.Add("age", "${maxResults}");
            pvs.Add("name", "${name}");
            ac.RegisterSingleton("tb1", typeof(TestObject), pvs);

            IList variableSources             = new ArrayList();
            CommandLineArgsVariableSource vs1 = new CommandLineArgsVariableSource(
                new string[] { "program.exe", "file.txt", "/name:Aleks Seovic", "/framework:Spring.NET" });

            variableSources.Add(vs1);

            ConfigSectionVariableSource vs2 = new ConfigSectionVariableSource();

            vs2.SectionName = "DaoConfiguration";
            variableSources.Add(vs2);


            pvs = new MutablePropertyValues();
            pvs.Add("VariableSources", variableSources);

            ac.RegisterSingleton("configurer", typeof(VariablePlaceholderConfigurer), pvs);
            ac.Refresh();

            TestObject tb1 = (TestObject)ac.GetObject("tb1");

            Assert.AreEqual(1000, tb1.Age);
            Assert.AreEqual("Aleks Seovic", tb1.Name);
        }
        public void TestVariablesResolution()
        {
            CommandLineArgsVariableSource vs = new CommandLineArgsVariableSource(
                new string[] { "program.exe", "file.txt", "/name:Aleks Seovic", "/framework:Spring.NET" });

            // existing vars
            Assert.AreEqual("Spring.NET", vs.ResolveVariable("FRAMEWORK"));
            Assert.AreEqual("Spring.NET", vs.ResolveVariable("framework"));
            Assert.AreEqual("Aleks Seovic", vs.ResolveVariable("name"));
            Assert.AreEqual("Aleks Seovic", vs.ResolveVariable("NAME"));

            // non-existant variable
            Assert.IsNull(vs.ResolveVariable("dummy"));
        }
        public void TestVariablesResolution()
        {
            CommandLineArgsVariableSource vs = new CommandLineArgsVariableSource(
                new string[] {"program.exe", "file.txt", "/name:Aleks Seovic", "/framework:Spring.NET"});

            // existing vars
            Assert.AreEqual("Spring.NET", vs.ResolveVariable("FRAMEWORK"));
            Assert.AreEqual("Spring.NET", vs.ResolveVariable("framework"));
            Assert.AreEqual("Aleks Seovic", vs.ResolveVariable("name"));
            Assert.AreEqual("Aleks Seovic", vs.ResolveVariable("NAME"));

            // non-existant variable
            Assert.IsNull(vs.ResolveVariable("dummy"));
        }
        public void TestVariablesResolutionWithCustomPrefixAndSeparator()
        {
            CommandLineArgsVariableSource vs = new CommandLineArgsVariableSource(
                new string[] { "program.exe", "file.txt", "--Name=Aleks Seovic", "--Framework=Spring.NET" });
            vs.ArgumentPrefix = "--";
            vs.ValueSeparator = "=";

            // existing vars
            Assert.AreEqual("Spring.NET", vs.ResolveVariable("FRAMEWORK"));
            Assert.AreEqual("Spring.NET", vs.ResolveVariable("framework"));
            Assert.AreEqual("Aleks Seovic", vs.ResolveVariable("name"));
            Assert.AreEqual("Aleks Seovic", vs.ResolveVariable("NAME"));

            // non-existant variable
            Assert.IsNull(vs.ResolveVariable("dummy"));
        }
        public void TestVariablesResolutionWithCustomPrefixAndSeparator()
        {
            CommandLineArgsVariableSource vs = new CommandLineArgsVariableSource(
                new string[] { "program.exe", "file.txt", "--Name=Aleks Seovic", "--Framework=Spring.NET" });

            vs.ArgumentPrefix = "--";
            vs.ValueSeparator = "=";

            // existing vars
            Assert.AreEqual("Spring.NET", vs.ResolveVariable("FRAMEWORK"));
            Assert.AreEqual("Spring.NET", vs.ResolveVariable("framework"));
            Assert.AreEqual("Aleks Seovic", vs.ResolveVariable("name"));
            Assert.AreEqual("Aleks Seovic", vs.ResolveVariable("NAME"));

            // non-existant variable
            Assert.IsNull(vs.ResolveVariable("dummy"));
        }
        public void TestLiveVariablesResolutionWithTestDriven()
        {
            CommandLineArgsVariableSource vs = new CommandLineArgsVariableSource();

            Assert.IsTrue(vs.ResolveVariable("AssemblyName").StartsWith("TestDriven.TestRunner.Server"));
        }
 public void TestLiveVariablesResolutionWithTestDriven()
 {
     CommandLineArgsVariableSource vs = new CommandLineArgsVariableSource();
     Assert.IsTrue(((string) vs.ResolveVariable("AssemblyName")).StartsWith("TestDriven.TestRunner.Server"));
 }
        public void SunnyDay()
        {
            StaticApplicationContext ac = new StaticApplicationContext();

            MutablePropertyValues pvs = new MutablePropertyValues();
            pvs.Add("age", "${maxResults}");
            pvs.Add("name", "${name}");
            ac.RegisterSingleton("tb1", typeof(TestObject), pvs);

            IList variableSources = new ArrayList();
            CommandLineArgsVariableSource vs1 = new CommandLineArgsVariableSource(
                new string[] { "program.exe", "file.txt", "/name:Aleks Seovic", "/framework:Spring.NET" });
            variableSources.Add(vs1);

            ConfigSectionVariableSource vs2 = new ConfigSectionVariableSource();
            vs2.SectionName = "DaoConfiguration";
            variableSources.Add(vs2);


            pvs = new MutablePropertyValues();
            pvs.Add("VariableSources", variableSources);

            ac.RegisterSingleton("configurer", typeof(VariablePlaceholderConfigurer), pvs);
            ac.Refresh();

            TestObject tb1 = (TestObject)ac.GetObject("tb1");
            Assert.AreEqual(1000, tb1.Age);
            Assert.AreEqual("Aleks Seovic", tb1.Name);

        }