public void t11_Parse_Class_With_Multiple_Fields()
        {
            var tokens = TokenStreamBuilder.Class("className",
                                                  TokenStreamBuilder.CombineTokenStreams(
                                                      TokenStreamBuilder.Field("fieldName", "fieldType"),
                                                      new ClassDiagramTokenStream {
                TokenType.Comma.Token()
            },                                                                                                 // TODO single-token streams.
                                                      TokenStreamBuilder.Field("fieldName2", "fieldType2")
                                                      )
                                                  );

            var classDiagram = new ClassDiagramParser(tokens).ParseClassDiagram();
            var c            = classDiagram.Classes.ToList()[0];

            Assert.IsNotNull(classDiagram, "failed to parse the class");
            Assert.AreEqual("className", c.Name, "name wrong");
            Assert.IsNotNull(c.Fields, "fields MUST NOT be null");
            var l = c.Fields.ToList();

            Assert.AreEqual(2, l.Count, "There should be exactly one field");
            var f = l[0];

            Assert.AreEqual("fieldName", f.Name, "field name wrong");
            Assert.AreEqual("fieldType", f.Type, "field type wrong");
            f = l[1];
            Assert.AreEqual("fieldName2", f.Name, "2nd field name wrong");
            Assert.AreEqual("fieldType2", f.Type, "2nd field type wrong");
        }
        public void t07_Parse_ClassDiagram_Containing_Two_Associated_Classes_Aggregation_Alternative()
        {
            var tokens = TokenStreamBuilder.CombineTokenStreams(
                TokenStreamBuilder.Class("a"),
                new ClassDiagramTokenStream {
                TokenType.AngleOpen.Token(), TokenType.AngleClose.Token(), TokenType.Dash.Token(), TokenType.AngleClose.Token(),
            },
                TokenStreamBuilder.Class("b")
                );

            t07_Parse_ClassDiagram_Containing_Two_Associated_Classes(tokens, AssociationKind.Aggregation);
        }
        public void t17_Multiplicity(TestData data)
        {
            var tokens = TokenStreamBuilder.CombineTokenStreams(
                TokenStreamBuilder.FromStrings("[", "a", "]"),
                TokenStreamBuilder.FromStrings(data.Arguments),
                TokenStreamBuilder.FromStrings("-", ">", "[", "b", "]"));
            var cd     = tokens.ParseClassDiagram();
            var assocs = cd.Associations.ToList();
            var mult   = assocs[0].SourceMultiplicity;

            Assert.IsNotNull(mult, "should have parsed");
        }
        public void t16_Class_No_Fields_Just_Methods()
        {
            // [a]-[b]-[c]
            var tokens = TokenStreamBuilder.CombineTokenStreams(
                TokenStreamBuilder.FromStrings("[", "a", "|", "|"),
                TokenStreamBuilder.Method("methodName"),
                TokenStreamBuilder.FromStrings("]")
                );

            var classDiagram = new ClassDiagramParser(tokens).ParseClassDiagram();
            var c            = classDiagram.Classes.ToList()[0];

            Assert.IsNotNull(classDiagram, "class parse error");
            Assert.AreEqual(0, c.Fields.Count(), "there should be no fields");
            Assert.AreEqual(1, c.Methods.Count(), "there should be one method");
            AssertMethod(c.Methods.ToArray()[0], VisibilityModifier.Public, "methodName");
        }
        public void t15_Parse_Three_Associated_Classes()
        {
            // [a]-[b]-[c]
            var tokens = TokenStreamBuilder.CombineTokenStreams(
                TokenStreamBuilder.Class("a"),
                TokenStreamBuilder.PureAssociation("-"),
                TokenStreamBuilder.Class("b"),
                TokenStreamBuilder.PureAssociation("-"),
                TokenStreamBuilder.Class("c")
                );

            var cd = new ClassDiagramParser(tokens).ParseClassDiagram();

            Assert.IsNotNull(cd, "class diagram1 parse error");
            Assert.AreEqual(3, cd.Classes.Count(), "wrong class count");
            Assert.AreEqual(2, cd.Associations.Count(), "wrong association count");
            // TODO more tests...
        }