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"); }
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(); }
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); }
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); } }
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); } }