public void GivenAnElementIsInTheModelWhenRemoveElementIsCalledThenElementIsNotFoundAnymoreByItName() { DsiElementModel model = new DsiElementModel(); Assert.AreEqual(0, model.TotalElementCount); model.ImportElement(1, "name", "type", "source"); IDsiElement foundElementBefore = model.FindElementByName("name"); Assert.IsNotNull(foundElementBefore); model.RemoveElement(foundElementBefore); IDsiElement foundElementAfter = model.FindElementByName("name"); Assert.IsNull(foundElementAfter); }
public void GivenAnElementIsInTheModelWhenFindByIdIsCalledWithAnotherNameThenElementIsNotFound() { DsiElementModel model = new DsiElementModel(); Assert.AreEqual(0, model.TotalElementCount); model.ImportElement(1, "name", "type", "source"); IDsiElement foundElement = model.FindElementByName("unknown"); Assert.IsNull(foundElement); }
public void GivenAnElementIsInTheModelWhenFindByIdIsCalledWithItsNameThenElementIsFound() { DsiElementModel model = new DsiElementModel(); Assert.AreEqual(0, model.TotalElementCount); model.ImportElement(1, "name", "type", "source"); IDsiElement foundElement = model.FindElementByName("name"); Assert.IsNotNull(foundElement); Assert.AreEqual(1, foundElement.Id); Assert.AreEqual("name", foundElement.Name); Assert.AreEqual("type", foundElement.Type); Assert.AreEqual("source", foundElement.Source); }
public void WhenRenameElementIsCalledThenItCanBeFoundUnderThatName() { DsiElementModel model = new DsiElementModel(); Assert.AreEqual(0, model.TotalElementCount); IDsiElement element = model.AddElement("name", "type", "source"); Assert.IsNotNull(element); Assert.AreEqual(1, model.TotalElementCount); model.RenameElement(element, "newname"); Assert.AreEqual(1, model.TotalElementCount); IDsiElement foundElement = model.FindElementByName("newname"); Assert.IsNotNull(foundElement); Assert.AreEqual(1, foundElement.Id); Assert.AreEqual("newname", foundElement.Name); Assert.AreEqual("type", foundElement.Type); Assert.AreEqual("source", foundElement.Source); }