public void t17_Errors(TestData data)
        {
            var tokens   = TokenStreamBuilder.FromStrings(data.Arguments);
            var callback = RetrieveErrorCallback(data, tokens);

            ExpectError(callback);
        }
        public void t14_Parse_Method_VisibilityModifier(string modifier, VisibilityModifier expectedVisibility)
        {
            var tokens       = TokenStreamBuilder.FromStrings("[", "a", "|", "|", modifier, "methodName", "(", ")", "]");
            var classDiagram = new ClassDiagramParser(tokens).ParseClassDiagram();
            var m            = classDiagram.Classes.ToList()[0].Methods.ToList()[0];

            Assert.AreEqual(expectedVisibility, m.Visibility, "unexpected visibility");
        }
        public void t14_Parse_Class_With_Method()
        {
            // [className||-methodName(paramType paramName)]
            var tokens = TokenStreamBuilder.FromStrings("[", "className", "|", "|", "-", "methodName", "(", "paramType", "paramName", ")", "]");

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

            Assert.IsNotNull(classDiagram, "class parse error");
        }
        public void t14_Parse_Method_ReturnType()
        {
            var tokens       = TokenStreamBuilder.FromStrings("[", "a", "|", "|", "methodName", "(", ")", ":", "returntype", "]");
            var classDiagram = new ClassDiagramParser(tokens).ParseClassDiagram();
            var m            = classDiagram.Classes.ToList()[0].Methods.ToList()[0];

            Assert.IsNotNull(classDiagram, "method parse error");
            Assert.AreEqual("returntype", m.ReturnType);
        }
        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 t13_Parse_Field_With_AccessModifier(String modifier, VisibilityModifier expectedVm)
        {
            var tokens = TokenStreamBuilder.FromStrings("[", "a", "|", modifier, "fieldName", ":", "fieldType", "]");

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

            Assert.IsNotNull(classDiagram, "field parsing failed");
            Assert.AreEqual("fieldName", f.Name);
            Assert.AreEqual("fieldType", f.Type);
            Assert.AreEqual(expectedVm, f.Visibility, "wrong visibility modifier");
        }
        public void t14_Parse_Method_Parameter(string parameterType)
        {
            var tokens = TokenStreamBuilder.FromStrings("[", "c", "|", "|", "methodName", "(", parameterType, "parameter", ")", "]");

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

            Assert.IsNotNull(classDiagram, "method parse error");
            var parameters = new List <MethodParameter>(m.Parameters);

            Assert.AreEqual(1, parameters.Count, "wrong parameter count");
            Assert.AreEqual("parameter", parameters[0].Name, "wrong name");
            Assert.AreEqual(parameterType, parameters[0].Type, "wrong type");
        }
        public void t06_Parse_ClassDiagram_Containing_One_Class()
        {
            var tokens = TokenStreamBuilder.FromStrings("[", "a", "]");

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

            Assert.IsNotNull(cd, "parsing failed");

            var classes = cd.Classes.ToList();

            Assert.AreEqual(1, classes.Count, "wrong class count");
            Assert.AreEqual("a", classes[0].Name, "unexpected class name");
        }
        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");
        }