Exemplo n.º 1
0
        public void ReadonlyNodeCollection_IsNotEditable()
        {
            var subject = new VariableDeclarationList();

            subject.MakeReadonly();

            Action action = () => subject.Declarations.Add(new VariableDeclaration());

            action.Should().Throw <InvalidOperationException>();
        }
Exemplo n.º 2
0
        public void ParentNodeReadonlyMode_WillPropagateToChildNodes()
        {
            var subjectIdentifier = new Identifier();
            var subject           = new VariableDeclarationList();
            var declaration       = new VariableDeclaration();

            declaration.Name = subjectIdentifier;
            subject.Declarations.Add(declaration);

            subject.MakeReadonly();

            Action action = () => subjectIdentifier.Name = "NewValue";

            action.Should().Throw <InvalidOperationException>();
        }