예제 #1
0
        public void TestInitialize()
        {
            _context = new ComponentContext();
            _context.Configuration.DisableAttributeChecking = true;

            _context.Register(typeof(ComponentOne));
            _context.SetVariableValue("one", "someString");
            _context.SetVariableValue("two", 5);
        }
예제 #2
0
        public void GetAPreviouslySetAndUnset()
        {
            _context.SetVariableValue("variable", null);

            var v = _context.GetVariable("variable");

            Assert.IsNull(v);
        }
예제 #3
0
        public void SetDirectValue()
        {
            _context.SetVariableValue("variable", "variableValue");

            var v = _context.GetVariable("variable");

            Assert.IsNotNull(v);
            Assert.IsInstanceOfType(v, typeof(string));
            Assert.AreEqual(v, "variableValue");
        }
예제 #4
0
        static void Main()
        {
            var context = new ComponentContext();

            context.ProcessCompositionXmlFromResource("Compositional.Composer.Samples.Basic.CalculatorComposition.xml");

            context.SetVariableValue("Verbose", true);

            context.GetComponent <IProgramRunner>().Run();
        }
예제 #5
0
        public void OptNamedConfigProvidedByVar()
        {
            _context.Register(typeof(ComponentWithOptionalNamedConfig));
            _context.SetVariableValue("someVariable", "SomeConfigValue");

            var c = _context.GetComponent <ComponentWithOptionalNamedConfig>();

            Assert.IsNotNull(c);
            Assert.IsNotNull(c.SomeConfig);
            Assert.AreEqual(c.SomeConfig, "SomeConfigValue");
        }
예제 #6
0
        public void GetVariableValue()
        {
            var vLazy = _context.LazyGetVariable("varName");

            _context.SetVariableValue("varName", "varValue");

            var v = vLazy.Value;

            Assert.IsNotNull(v);
            Assert.AreEqual(v, "varValue");
        }
예제 #7
0
 public void TestInitialize()
 {
     _context = new ComponentContext();
     _context.SetVariableValue("SomeConfigurationPoint", "SomeConfigurationValue");
 }
예제 #8
0
 public void TestInitialize()
 {
     _context = new ComponentContext();
     _context.SetVariableValue("variable", "variableValue");
 }