コード例 #1
0
        public void TestItemIndexerOnNET_String_Setter()
        {
            var expected = "One";
            var key      = "alpha";
            var myobject = new ClassWithItemIndexerString
            {
                [key] = "Initial"
            };

            _ = Template.Parse($"{{{{obj['{key}'] = '{expected}'}}}}").Render(new ScriptObject()
            {
                { "obj", myobject }
            });
            Assert.AreEqual(expected, myobject[key]);
        }
コード例 #2
0
        public void TestItemIndexerOnNET_String_Getter()
        {
            var expected = "One";
            var key      = "alpha";
            var myobject = new ClassWithItemIndexerString
            {
                [key] = expected
            };
            var result = Template.Parse($"{{{{obj['{key}']}}}}").Render(new ScriptObject()
            {
                { "obj", myobject }
            });

            Assert.AreEqual(expected, result);
        }