Ejemplo n.º 1
0
        public void TestScriptContextWithFunctions()
        {
            IStringTemplateRenderer <ScriptContext> renderer = templateRendererFactory.newTemplateRenderer <ScriptContext>(
                "GetFlights(seq).Length.ToString()"
                );

            string[] results = { Invoke(renderer, 3), Invoke(renderer, 7), Invoke(renderer, 12) };
            Assert.Equal(new string[] { "3", "4", "5" }, results);
        }
Ejemplo n.º 2
0
 private string Invoke(IStringTemplateRenderer <ScriptContext> renderer, int seq)
 {
     return(renderer.Render(
                new ScriptContext
     {
         GetFlights = s => NextKmlCameraParameterValues(s),
         seq = seq
     }
                ));
 }
Ejemplo n.º 3
0
 public void BasicGenericTemplateRendererTest()
 {
     string[] templateVersions =
     {
         "<kml iv1='{iv1}' sv1='{sv1}' />",          // KML template
         "@$\"<kml iv1='{iv1}' sv1='{sv1}' />\""     // Script template
     };
     foreach (string templateVersion in templateVersions)
     {
         IStringTemplateRenderer <RenderValues> testRenderer = templateRendererFactory.newTemplateRenderer <RenderValues>(templateVersion);
         Assert.Equal("<kml iv1='9965' sv1='' />", testRenderer.Render(new RenderValues {
             iv1 = 9965
         }));
     }
 }