Esempio n. 1
0
        public void NoTemplate()
        {
            dynamic source = new NullingExpandoObject();

            source.AString = "bubbles";
            var result = ExistingDataManager.ProcessVariable(typeof(Helper), "bob", null, source);
            var r      = result as Helper;

            r.AString.Should().Be("bubbles");
        }
Esempio n. 2
0
        public void NamedTemplateNotUsed()
        {
            TemplateManager.Register <Helper>((x) => { x.BString = "bobber"; }, "someTemplate");
            dynamic source = new NullingExpandoObject();

            source.AString = "bubbles";
            var result = ExistingDataManager.ProcessVariable(typeof(Helper), "bob", null, source);
            var r      = result as Helper;

            r.AString.Should().Be("bubbles");
            r.BString.Should().BeNull();
        }
Esempio n. 3
0
        public void DefaultTemplate()
        {
            TemplateManager.Register <Helper>((x) => { x.BInt = 42; });
            dynamic source = new NullingExpandoObject();

            source.AString = "bubbles";
            var result = ExistingDataManager.ProcessVariable(typeof(Helper), "bob", null, source);
            var r      = result as Helper;

            r.AString.Should().Be("bubbles");
            r.BInt.Should().Be(42);
        }
Esempio n. 4
0
 public void EnvironmentVariableOverrideTypeConversion()
 {
     Environment.SetEnvironmentVariable("bob_AInt", "42");
     try
     {
         dynamic source = new NullingExpandoObject();
         var     result = ExistingDataManager.ProcessVariable(typeof(Helper), "bob", null, source);
         var     r      = result as Helper;
         r.AInt.Should().Be(42);
     }
     finally
     {
         Environment.SetEnvironmentVariable("bob_AInt", null);
     }
 }
Esempio n. 5
0
 public void EnvironmentVariableOverride()
 {
     Environment.SetEnvironmentVariable("bob_AString", "Value1");
     try
     {
         dynamic source = new NullingExpandoObject();
         source.AString = "bubbles";
         var result = ExistingDataManager.ProcessVariable(typeof(Helper), "bob", null, source);
         var r      = result as Helper;
         r.AString.Should().Be("Value1");
     }
     finally
     {
         Environment.SetEnvironmentVariable("bob_AString", null);
     }
 }