Exemplo n.º 1
0
    public string Get()
    {
        var expected = "ThePropValue";
        var template = "@Model.SomeClass.SomeProp";
        var data     = new { SomeClass = new { SomeProp = expected } };

        return(_templateEngine.Convert(data, template));
    }
        public void Convert_GivenValidInput_ShouldConvert()
        {
            // arrange
            Setup();
            var data     = new { Name = "TheName" };
            var template = "Name is @Model.Name";

            // action
            var result = _engine.Convert(data, template, true);

            // assert
            result.Should().Be("Name is TheName");
        }
Exemplo n.º 3
0
        public async Task Convert_GivenValidController_ShouldConvertItem()
        {
            // arrange
            Setup();
            var expected        = "ThePropValue";
            var _templateEngine = new RazorTemplateEngine();
            var template        = "@Model.SomeClass.SomeProp";
            var data            = new { SomeClass = new { SomeProp = expected } };

            // action
            var result = _templateEngine.Convert(data, template);

            // assert
            result.Should().Be(expected);
        }