kbilsted / StatePrinter

Automating unit testing and ToString() coding
Apache License 2.0
93 stars 32 forks source link

Weird output of data structure #42

Open kbilsted opened 9 years ago

kbilsted commented 9 years ago

curly style output of

public class TagsCollection
{
    public Dictionary<string, List<string>> Pages = new Dictionary<string, List<string>>();

    public void Add(string tag, string url)
    {
        List<string> urls;
        if (!Pages.TryGetValue(tag, out urls))
            Pages.Add(tag, urls = new List<string>());
        urls.Add(url);
    }
}

becomes

var expected = @"new TagsCollection()
{
    Pages[""Design""] = new List<String>()
    Pages[0] = ""Articles\Design\MalleableCodeUsingDecorators.md""
    Pages[""SOLID""] = new List<String>()
    Pages[0] = ""Articles\Design\MalleableCodeUsingDecorators.md""
    Pages[1] = ""BookReviews\Adaptive Code via CS.md""
    Pages[""Single_Responsibility_Principle""] = new List<String>()
    Pages[0] = ""Articles\Design\MalleableCodeUsingDecorators.md""
    Pages[""Design_Pattern""] = new List<String>()
    Pages[0] = ""Articles\Design\MalleableCodeUsingDecorators.md""
    Pages[""Decorator""] = new List<String>()
    Pages[0] = ""Articles\Design\MalleableCodeUsingDecorators.md""
    Pages[""Wrapper""] = new List<String>()
    Pages[0] = ""Articles\Design\MalleableCodeUsingDecorators.md""
    Pages[""Cache""] = new List<String>()
    Pages[0] = ""Articles\Design\MalleableCodeUsingDecorators.md""
    Pages[""Book_Review""] = new List<String>()
    Pages[0] = ""BookReviews\Adaptive Code via CS.md""
}";
kbilsted commented 8 years ago

this bug may very well have been solved in 3.0 - need to check