Exemple #1
0
        public void RuntimeTextTemplate()
        {
            var rt = new RuntimeTextTemplate
            {
                Session = new Dictionary <string, object>()
            };

            rt.Session["Count"] = 7;
            rt.Initialize();
            Console.WriteLine(rt.TransformText());
        }
        public void RuntimeTextTemplate_TransformText_ExpectedOutput()
        {
            // Act
            var runtimeTextTemplate = new RuntimeTextTemplate
            {
                Session = new Dictionary <string, object>
                {
                    { "namespaceName", "Model" },
                    { "classes", JsonConvert.DeserializeObject <ClassTemplateInfo[]>(File.ReadAllText(@"ClassTemplateInfos.json")) }
                }
            };

            runtimeTextTemplate.Initialize();

            // Assert
            Approvals.Verify(runtimeTextTemplate.TransformText());
        }
        public void RuntimeTextTemplate_TransformText_ExpectedOutput()
        {
            // Act
            var runtimeTextTemplate = new RuntimeTextTemplate
                {
                    Session = new Dictionary<string, object>
                        {
                            { "namespaceName", "Model" },
                            { "classes", JsonConvert.DeserializeObject<ClassTemplateInfo[]>(File.ReadAllText(@"ClassTemplateInfos.json")) }
                        }
                };

            runtimeTextTemplate.Initialize();

            // Assert
            Approvals.Verify(runtimeTextTemplate.TransformText());
        }