-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
The unit test below fails because the result is just a ToString() of the SimpleModel.
How do we get the RazorMachine to use the SimpleModel template?
namespace RazorMachine.Test
{
public class SimpleModel
{
public string Name { get; set; }
}
public class ComplexModel
{
public SimpleModel SubProperty { get; set; }
}
[TestClass]
public class RazorMachineTest
{
[TestMethod]
public void ComplexModel()
{
const string expected = "name";
var model = new ComplexModel() { SubProperty = new SimpleModel() { Name = expected } };
var engine = new RazorMachine(includeGeneratedSourceCode: true);
engine.RegisterTemplate("~/SimpleModel.cshtml",
@"@model RazorMachine.Test.SimpleModel
@Model.Name");
ITemplate test = engine.Execute("@Model.SubProperty", model);
Assert.AreEqual(expected, test.ToString());
}
}
}Metadata
Metadata
Assignees
Labels
No labels