I've written a test to replicate this problem - this would be really useful functionality for us.
/// <summary>
/// Testing with Dynamic object.
/// </summary>
[TestMethod]
public void TestCompile_DynamicObject_RendersCorrectly() {
FormatCompiler compiler = new FormatCompiler();
const string format = @"Hello {{Name}}";
Generator generator = compiler.Compile(format);
dynamic obj = new TestDymnamic();
Assert.AreEqual("Paul", obj.Name);
string actual = generator.Render(obj);
string expected = "Hello Paul";
Assert.AreEqual(expected, actual, "The number was not passed to the formatter.");
}
private class TestDymnamic: DynamicObject {
public override bool TryGetMember(GetMemberBinder binder, out object result) {
result = "Paul";
return true;
}
}
I've written a test to replicate this problem - this would be really useful functionality for us.