예제 #1
0
            public MustacheTest(string specName, JToken test, JObject stronglyTypedExamples)
            {
                this.SpecName      = specName;
                this.SanitizedName = Sanitize(test["name"].ToString());
                this.test          = test;
                this.Template      = StripReservedWords(test["template"].ToString());

                if (stronglyTypedExamples.Children().Any())
                {
                    if (stronglyTypedExamples[SanitizedName] != null)
                    {
                        this.Example =
                            new JavaScriptSerializer().DeserializeObject(stronglyTypedExamples[SanitizedName].ToString());
                    }
                    else
                    {
                        this.Example = new object();
                    }

                    var stronglyTypedClass = Assembly.GetExecutingAssembly().GetType(
                        Generate_Classes_from_JSON.FullTestClassName(specName, this.SanitizedName));
                    if (stronglyTypedClass != null)
                    {
                        this.StronglyTypedExample = Activator.CreateInstance(
                            stronglyTypedClass,
                            stronglyTypedExamples[this.SanitizedName]);
                    }
                }
                else
                {
                    this.StronglyTypedExample = new object();
                    this.Example = new object();
                }
            }
예제 #2
0
 // uncomment this to regenerate the specs from the mustache spec submodule
 //[Test]
 public void Generate()
 {
     Generate_Classes_from_JSON.Run();
 }