public void With() { RedNode <int> a = RedNode <int> .Create(0) .With(1); Assert.AreEqual(1, a.Value); }
public void Removal() { var node = RedNode <int> .Create(0) .Insert(0, 1) .WithoutAt(0); Assert.AreEqual(0, node.Elements.Count); }
public void TransitiveIdentityEquality() { var parent = RedNode <int> .Create(0).Insert(0, 1); var child1 = parent.Elements[0]; var child2 = child1.Parent.Elements[0]; Assert.IsTrue(ReferenceEquals(child1, child2)); }
public void Insertion() { var parent = RedNode <int> .Create(0).Insert(0, 1); var child = parent.Elements[0]; Assert.AreEqual(0, parent.Value); Assert.AreEqual(1, child.Value); }
public void Parenting() { RedNode <int> child = RedNode <int> .Create(0).WithParent(1); var parent = child.Parent; Assert.AreEqual(1, parent.Elements.Count); Assert.AreEqual(1, parent.Value); Assert.AreEqual(0, parent.Elements[0].Value); }
/// <summary> /// Concrete implementation of the abstract method, switching the type(the color) of the node. /// </summary> /// <returns>A new node from type RedNode()</returns> public override INode Update() { var newNode = new RedNode(); foreach (var neig in this.Neighbours) { newNode.Neighbours.Add(neig); } return(newNode); }
public void RootDoesntHaveParentTest() { RedNode <int> node = RedNode <int> .Create(0); Assert.IsNull(node.Parent); }
public void CreationTest() { RedNode <int> node = RedNode <int> .Create(0); Assert.AreEqual(0, node.Value); }
internal abstract RedNode CreateRedNode(RedNode parent, int position);
internal CompilationUnitSyntax(InternalSyntax.SyntaxNode green, RedNode parent, int position) : base(green, parent, position) { }
internal override RedNode CreateRedNode(RedNode parent, int position) { return(new SlothCodeAnalysis.Syntax.CompilationUnitSyntax(this, parent, position)); }
internal override RedNode CreateRedNode(RedNode parent, int position) { return(new SlothCodeAnalysis.Syntax.LiteralExpressionSyntax(this, parent, position)); }
internal override RedNode CreateRedNode(RedNode parent, int position) { return(new SlothCodeAnalysis.Syntax.VariableDeclarationSyntax(this, parent, position)); }
internal VariableDeclarationSyntax(InternalSyntax.SyntaxNode green, RedNode parent, int position) : base(green, parent, position) { }
internal BinaryExpressionSyntax(InternalSyntax.SyntaxNode green, RedNode parent, int position) : base(green, parent, position) { }
internal StatementSyntax(InternalSyntax.SyntaxNode green, RedNode parent, int position) : base(green, parent, position) { }
internal override RedNode CreateRedNode(RedNode parent, int position) { return(new SlothCodeAnalysis.Syntax.IdentifierNameSyntax(this, parent, position)); }
internal override RedNode CreateRedNode(RedNode parent, int position) { return(new SlothCodeAnalysis.Syntax.SyntaxList(this, parent, position)); }
internal override RedNode CreateRedNode(RedNode parent, int position) { throw ExceptionUtilities.Unreachable; }
internal IdentifierNameSyntax(InternalSyntax.SyntaxNode green, RedNode parent, int position) : base(green, parent, position) { }