Esempio n. 1
0
        public void GivenAnActiveCompilationUnit_WhenAClassIsFound_ThenTheClassIsAddedToTheClassModel()
        {
            CompilationUnit compilationUnit = new CompilationUnit("");

            _classListener.setCurrentCompilationUnit(compilationUnit);

            Mocks.ClassContextMock classContext = new Mocks.ClassContextMock(null, 1);
            _classListener.EnterClassDeclaration(classContext);

            _classListener.resetCurrentComilationUnit();

            Assert.AreEqual(compilationUnit.Classes.Count, 1);
            Assert.AreEqual("test", compilationUnit.Classes[0].Content);
        }
Esempio n. 2
0
        public void GivenNoActiveCompilationUnit_WhenAClassIsFound_ThenTheClassIsIgnored()
        {
            Mocks.ClassContextMock classContext = new Mocks.ClassContextMock(null, 1);

            Assert.DoesNotThrow(() => _classListener.EnterClassDeclaration(classContext));
        }