public void DefaultValues() { var sut = new SwitchBlock(); Assert.AreEqual(new VariableReference(), sut.Reference); Assert.AreEqual(Lists.NewList <IStatement>(), sut.Sections); Assert.AreEqual(Lists.NewList <IStatement>(), sut.DefaultSection); Assert.AreNotEqual(0, sut.GetHashCode()); Assert.AreNotEqual(1, sut.GetHashCode()); }
public void Equality_Default() { var a = new SwitchBlock(); var b = new SwitchBlock(); Assert.AreEqual(a, b); Assert.AreEqual(a.GetHashCode(), b.GetHashCode()); }
public void Equality_DifferentDefaultSection() { var a = new SwitchBlock(); a.DefaultSection.Add(new ReturnStatement()); var b = new SwitchBlock(); Assert.AreNotEqual(a, b); Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode()); }
public void Equality_DifferentSections() { var a = new SwitchBlock(); a.Sections.Add(new CaseBlock()); var b = new SwitchBlock(); Assert.AreNotEqual(a, b); Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode()); }
public void Equality_DifferentReference() { var a = new SwitchBlock { Reference = SomeVarRef("a") }; var b = new SwitchBlock(); Assert.AreNotEqual(a, b); Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode()); }
public void Equality_ReallyTheSame() { var a = new SwitchBlock { Reference = SomeVarRef("a"), Sections = { new CaseBlock() }, DefaultSection = { new ReturnStatement() } }; var b = new SwitchBlock { Reference = SomeVarRef("a"), Sections = { new CaseBlock() }, DefaultSection = { new ReturnStatement() } }; Assert.AreEqual(a, b); Assert.AreEqual(a.GetHashCode(), b.GetHashCode()); }