コード例 #1
0
        public void ClassWith2Properties()
        {
            IModel model = Build.Class("Class001").WithProperty("PROP001", "Comment").WithProperty("PROP002", "Comment").Model();
            ModelFormatter formatter = new ModelFormatter(model);

            Assert.That(formatter.Render(), Is.EqualTo("[Class] Class001\r\n  [Property] PROP001 /*...*/\r\n  [Property] PROP002 /*...*/"));
        }
コード例 #2
0
        public void ClassWith2BranchesOfPropertiesWithPath()
        {
            IModel model = Build
                           .Class("Class001").With(
                Build.Property("PROP00A", "Comment").WithProperty("PROP0A1", "Comment").WithProperty("PROP0A2", "Comment")
                )
                           .With(
                Build.Property("PROP00B", "Comment").WithProperty("PROP0B1", "Comment").WithProperty("PROP0B2", "Comment")
                ).Model();
            ModelFormatter formatter = new ModelFormatter(model)
            {
                IncludeModelPaths = true
            };

            const string expected = "1: [Class] Class001\r\n" +
                                    "1.1: [Property] PROP00A /*...*/\r\n" +
                                    "1.1.1: [Property] PROP0A1 /*...*/\r\n" +
                                    "1.1.2: [Property] PROP0A2 /*...*/\r\n" +
                                    "1.2: [Property] PROP00B /*...*/\r\n" +
                                    "1.2.1: [Property] PROP0B1 /*...*/\r\n" +
                                    "1.2.2: [Property] PROP0B2 /*...*/" +
                                    "";

            Assert.That(formatter.Render(), Is.EqualTo(expected));
        }
コード例 #3
0
        public void ClassWith2Properties()
        {
            IModel         model     = Build.Class("Class001").WithProperty("PROP001", "Comment").WithProperty("PROP002", "Comment").Model();
            ModelFormatter formatter = new ModelFormatter(model);

            Assert.That(formatter.Render(), Is.EqualTo("[Class] Class001\r\n  [Property] PROP001 /*...*/\r\n  [Property] PROP002 /*...*/"));
        }
コード例 #4
0
        public void CobolModelWithPath()
        {
            ModelFormatter formatter = new ModelFormatter(new CobolModel("Name", "Data"))
            {
                IncludeModelPaths = true
            };

            Assert.That(formatter.Render(), Is.EqualTo("1: [Name] Data"));
        }
コード例 #5
0
        public void ClassWith2DeepPropertiesWithPath()
        {
            IModel model = Build.Class("Class001")
                               .With(Build.Property("PROP001", "Comment")
                                          .WithProperty("PROP002", "Comment"))
                               .Model();
            ModelFormatter formatter = new ModelFormatter(model){IncludeModelPaths = true};

            Assert.That(formatter.Render(), Is.EqualTo("1: [Class] Class001\r\n1.1: [Property] PROP001 /*...*/\r\n1.1.1: [Property] PROP002 /*...*/"));
        }
コード例 #6
0
        public void ClassWith2PropertiesWithPath()
        {
            IModel         model     = Build.Class("Class001").WithProperty("PROP001", "Comment").WithProperty("PROP002", "Comment").Model();
            ModelFormatter formatter = new ModelFormatter(model)
            {
                IncludeModelPaths = true
            };

            Assert.That(formatter.Render(), Is.EqualTo("1: [Class] Class001\r\n1.1: [Property] PROP001 /*...*/\r\n1.2: [Property] PROP002 /*...*/"));
        }
コード例 #7
0
        public void SameModelConstructed()
        {
            IModel simpleModel = Build
                                 .Class("MSF006-RECORD")
                                 .With(
                Build.Property("KEY-006", "comment")
                .WithDataType("DSTRCT-CODE PIC X(4)", "comment")
                .WithDataType("ACCOUNT-CODE PIC X(24)", "comment")
                .With(
                    Build.Property("CONTROL-ID", "comment")
                    .With(
                        Build.DataType("CONTROL-TYPE PIC X(1)", "comment")
                        .WithValue("MIMS-CONTROL VALUE 'M'", "comment")
                        .WithValue("INTER-DSTRCT-CTL VALUE 'I'", "comment")
                        .WithValue("SUBLEDGER-CTL VALUE 'S'", "comment")
                        .WithValue("TABLE-DSTRCT-CTL VALUE 'T'", "comment")
                        )
                    )

                ).Model();

            IModel verboseModel = Build
                                  .Class("MSF006-RECORD")
                                  .With(
                Build.Property("KEY-006", "comment")
                .With(Build.DataType("DSTRCT-CODE PIC X(4)", "comment"))
                .With(Build.DataType("ACCOUNT-CODE PIC X(24)", "comment"))
                .With(
                    Build.Property("CONTROL-ID", "comment")
                    .With(
                        Build.DataType("CONTROL-TYPE PIC X(1)", "comment")
                        .WithValue("MIMS-CONTROL VALUE 'M'", "comment")
                        .WithValue("INTER-DSTRCT-CTL VALUE 'I'", "comment")
                        .WithValue("SUBLEDGER-CTL VALUE 'S'", "comment")
                        .WithValue("TABLE-DSTRCT-CTL VALUE 'T'", "comment")
                        )
                    )

                ).Model();

            string simple = new ModelFormatter(simpleModel)
            {
                IncludeModelPaths = true
            }.Render();
            string verbose = new ModelFormatter(verboseModel)
            {
                IncludeModelPaths = true
            }.Render();

            Assert.That(simple, Is.EqualTo(verbose));
        }
コード例 #8
0
        public void ClassWith2BranchesOfPropertiesWithPath()
        {
            IModel model = Build
                .Class("Class001").With(
                    Build.Property("PROP00A", "Comment").WithProperty("PROP0A1", "Comment").WithProperty("PROP0A2", "Comment")
                )
                .With(
                    Build.Property("PROP00B", "Comment").WithProperty("PROP0B1", "Comment").WithProperty("PROP0B2", "Comment")
                ).Model();
            ModelFormatter formatter = new ModelFormatter(model){IncludeModelPaths = true};

            const string expected = "1: [Class] Class001\r\n" +
                                    "1.1: [Property] PROP00A /*...*/\r\n" +
                                    "1.1.1: [Property] PROP0A1 /*...*/\r\n" +
                                    "1.1.2: [Property] PROP0A2 /*...*/\r\n" +
                                    "1.2: [Property] PROP00B /*...*/\r\n" +
                                    "1.2.1: [Property] PROP0B1 /*...*/\r\n" +
                                    "1.2.2: [Property] PROP0B2 /*...*/" +
                                    "";

            Assert.That(formatter.Render(), Is.EqualTo(expected));
        }
コード例 #9
0
        public void SameModelConstructed()
        {
            IModel simpleModel = Build
                .Class("MSF006-RECORD")
                .With(
                    Build.Property("KEY-006", "comment")
                         .WithDataType("DSTRCT-CODE PIC X(4)", "comment")
                         .WithDataType("ACCOUNT-CODE PIC X(24)", "comment")
                         .With(
                             Build.Property("CONTROL-ID", "comment")
                                  .With(
                                      Build.DataType("CONTROL-TYPE PIC X(1)", "comment")
                                           .WithValue("MIMS-CONTROL VALUE 'M'", "comment")
                                           .WithValue("INTER-DSTRCT-CTL VALUE 'I'", "comment")
                                           .WithValue("SUBLEDGER-CTL VALUE 'S'", "comment")
                                           .WithValue("TABLE-DSTRCT-CTL VALUE 'T'", "comment")
                                 )
                        )

                ).Model();

            IModel verboseModel = Build
                .Class("MSF006-RECORD")
                .With(
                    Build.Property("KEY-006", "comment")
                         .With(Build.DataType("DSTRCT-CODE PIC X(4)", "comment"))
                         .With(Build.DataType("ACCOUNT-CODE PIC X(24)", "comment"))
                         .With(
                             Build.Property("CONTROL-ID", "comment")
                                  .With(
                                      Build.DataType("CONTROL-TYPE PIC X(1)", "comment")
                                           .WithValue("MIMS-CONTROL VALUE 'M'", "comment")
                                           .WithValue("INTER-DSTRCT-CTL VALUE 'I'", "comment")
                                           .WithValue("SUBLEDGER-CTL VALUE 'S'", "comment")
                                           .WithValue("TABLE-DSTRCT-CTL VALUE 'T'", "comment")
                                 )
                        )

                ).Model();

            string simple = new ModelFormatter(simpleModel) {IncludeModelPaths = true}.Render();
            string verbose = new ModelFormatter(verboseModel) { IncludeModelPaths = true }.Render();

            Assert.That(simple, Is.EqualTo(verbose));
        }
コード例 #10
0
        public void IgnoreModel()
        {
            ModelFormatter formatter = new ModelFormatter(new IgnoreModel("This is some data"));

            Assert.That(formatter.Render(), Is.EqualTo("[Ignore] This is some data"));
        }
コード例 #11
0
        public void StringModel()
        {
            ModelFormatter formatter = new ModelFormatter(new StringModel("Name", "Data"));

            Assert.That(formatter.Render(), Is.EqualTo("[Name] Data"));
        }
コード例 #12
0
        public void PageHeader()
        {
            ModelFormatter formatter = new ModelFormatter(new PageHeaderModel(new [] { "One", "Two", "Three" }));

            Assert.That(formatter.Render(), Is.EqualTo("[Page] One\r\n[Page] Two\r\n[Page] Three\r\n"));
        }
コード例 #13
0
        public void IgnoreModel()
        {
            ModelFormatter formatter = new ModelFormatter(new IgnoreModel("This is some data"));

            Assert.That(formatter.Render(), Is.EqualTo("[Ignore] This is some data"));
        }
コード例 #14
0
        public void CobolModelWithComment()
        {
            ModelFormatter formatter = new ModelFormatter(new CobolModel("Name", "Data", "Comment"));

            Assert.That(formatter.Render(), Is.EqualTo("[Name] Data /*...*/"));
        }
コード例 #15
0
        public void PageHeader()
        {
            ModelFormatter formatter = new ModelFormatter(new PageHeaderModel( new [] {"One", "Two", "Three"}));

            Assert.That(formatter.Render(), Is.EqualTo("[Page] One\r\n[Page] Two\r\n[Page] Three\r\n"));
        }
コード例 #16
0
        public void StringModel()
        {
            ModelFormatter formatter = new ModelFormatter(new StringModel("Name", "Data"));

            Assert.That(formatter.Render(), Is.EqualTo("[Name] Data"));
        }
コード例 #17
0
        public void CobolModelWithComment()
        {
            ModelFormatter formatter = new ModelFormatter(new CobolModel("Name", "Data", "Comment"));

            Assert.That(formatter.Render(), Is.EqualTo("[Name] Data /*...*/"));
        }
コード例 #18
0
        public void StringModelWithPath()
        {
            ModelFormatter formatter = new ModelFormatter(new StringModel("Name", "Data")) { IncludeModelPaths = true };

            Assert.That(formatter.Render(), Is.EqualTo("1: [Name] Data"));
        }