public void GivenMultipleElementAreInTheModelWhenSwapElementIsCalledOrderIsChanged() { DsmElementModel model = new DsmElementModel(); Assert.AreEqual(1, model.GetElementCount()); IDsmElement a = model.AddElement("a", "", null); Assert.AreEqual(1, a.Id); IDsmElement a1 = model.AddElement("a1", "eta", a.Id); Assert.AreEqual(2, a1.Id); IDsmElement a2 = model.AddElement("a2", "eta", a.Id); Assert.AreEqual(3, a2.Id); IDsmElement a3 = model.AddElement("a3", "eta", a.Id); Assert.AreEqual(4, a3.Id); List <IDsmElement> rootElementsBefore = model.GetRootElement().Children.ToList(); Assert.AreEqual(1, rootElementsBefore.Count); Assert.AreEqual(a, rootElementsBefore[0]); Assert.AreEqual(3, rootElementsBefore[0].Children.Count); Assert.AreEqual(a1, rootElementsBefore[0].Children[0]); Assert.AreEqual(a2, rootElementsBefore[0].Children[1]); Assert.AreEqual(a3, rootElementsBefore[0].Children[2]); model.Swap(a1, a2); List <IDsmElement> rootElementsAfter = model.GetRootElement().Children.ToList(); Assert.AreEqual(1, rootElementsAfter.Count); Assert.AreEqual(a, rootElementsAfter[0]); Assert.AreEqual(3, rootElementsAfter[0].Children.Count); Assert.AreEqual(a2, rootElementsAfter[0].Children[0]); Assert.AreEqual(a1, rootElementsAfter[0].Children[1]); Assert.AreEqual(a3, rootElementsAfter[0].Children[2]); }