Exemplo n.º 1
0
        public void read_file()
        {
            var spec = MarkdownReader.ReadFromText(@"
# Use an array argument

-> id = e0e4da7a-4d0a-41c6-940b-c9ed654194d2
-> lifecycle = Acceptance
-> max-retries = 0
-> last-updated = 2017-01-07T15:55:20.5381011Z
-> tags = 

[Array]
|> TheNameArrayShouldBe
``` names
Hank, Tom, Todd
```

|> FibonacciSeries
``` numbers
1,1,2,3
```

~~~
");

            var section = spec.Children[0].As <Section>();

            section.Children[0].As <Step>().StagedValues.ShouldBeNull();


            section.Children[0].As <Step>().Values["names"].ShouldBe("Hank, Tom, Todd");
            section.Children[1].As <Step>().Values["numbers"].ShouldBe("1,1,2,3");
        }
Exemplo n.º 2
0
        public void serialize_a_spec_with_extended_charactors()
        {
            var spec = MarkdownReader.ReadFromText(@"
# Use an array argument

-> id = e0e4da7a-4d0a-41c6-940b-c9ed654194d2
-> lifecycle = Acceptance
-> max-retries = 0
-> last-updated = 2017-01-07T15:55:20.5381011Z
-> tags = 

[Array]
|> TheNameArrayShouldBe
``` names
é, à, ç
```

|> FibonacciSeries
``` numbers
1,1,2,3
```

~~~
");

            var section = spec.Children[0].As <Section>();

            section.Children[0].As <Step>().Values["names"].ShouldBe("é, à, ç");

            var json = JsonSerialization.ToCleanJson(spec);

            json.ShouldContain("é, à, ç");
        }
        public void should_read_in_the_table_data_to_the_default_section()
        {
            theFixtures.AddWithDefaultCellHandling <NumberTableFixture>();

            var spec = MarkdownReader.ReadFromText(@"
# Some Specification

[NumberTable]
|> Add
|x|y|sum|
|1|2|3|
|2|3|5|
|6|4|10|

");

            var step = spec.Children.Single().ShouldBeOfType <Section>()
                       .Children.Single().ShouldBeOfType <Step>();

            step.Collections.Count.ShouldBe(1);

            step.Collections.Single().Key.ShouldBe(Table.DefaultCollectionName);

            step.Collections[Table.DefaultCollectionName].Children.Count.ShouldBe(3);

            var row1 = step.Collections[Table.DefaultCollectionName].Children.First().ShouldBeOfType <Step>();

            row1.Values["x"].ShouldBe("1");
            row1.Values["y"].ShouldBe("2");
            row1.Values["sum"].ShouldBe("3");
        }
        private void roundTripCheck(Specification spec)
        {
            spec.ApplyRenumbering();
            spec.path = null; // doesn't matter for the markdown persistence

            var markdown = MarkdownWriter.WriteToText(spec);

            var readCopy = MarkdownReader.ReadFromText(markdown);

            compare(spec, readCopy);
        }
        public persisting_and_loading_specifications_with_markdown()
        {
            original = new Specification();



            _persisted = new Lazy <Specification>(() =>
            {
                var text = MarkdownWriter.WriteToText(original);

                var x = MarkdownReader.ReadFromText(text);

                x.ShouldNotBeTheSameAs(original);

                return(x);
            });
        }