public void WhenAddElementIsCalledUsingTwoDifferentTypesThenTwoElementTypesAreFound() { DsiElementModel model = new DsiElementModel(); Assert.AreEqual(0, model.TotalElementCount); IDsiElement element1 = model.AddElement("name1", "type1", "source1"); Assert.IsNotNull(element1); Assert.AreEqual(1, model.TotalElementCount); IDsiElement element2 = model.AddElement("name2", "type2", "source2"); Assert.IsNotNull(element2); Assert.AreEqual(2, model.TotalElementCount); IDsiElement element3 = model.AddElement("name3", "type2", "source3"); Assert.IsNotNull(element3); Assert.AreEqual(3, model.TotalElementCount); List<string> elementTypes = model.GetElementTypes().ToList(); Assert.AreEqual(2, elementTypes.Count); Assert.AreEqual("type1", elementTypes[0]); Assert.AreEqual("type2", elementTypes[1]); Assert.AreEqual(1, model.GetElementTypeCount("type1")); Assert.AreEqual(2, model.GetElementTypeCount("type2")); }
public void TestInitialize() { _elementsDataModel = new DsiElementModel(); _a = _elementsDataModel.AddElement("a", "", ""); _b = _elementsDataModel.AddElement("b", "", ""); _c = _elementsDataModel.AddElement("c", "", ""); }
public void GivenAnElementIsInTheModelWhenAddElementIsCalledForAnotherElementThenItHasTwoElement() { DsiElementModel model = new DsiElementModel(); Assert.AreEqual(0, model.TotalElementCount); IDsiElement element1 = model.AddElement("name1", "type", "source"); Assert.IsNotNull(element1); Assert.AreEqual(1, model.TotalElementCount); IDsiElement element2 = model.AddElement("name2", "type", "source"); Assert.IsNotNull(element2); Assert.AreEqual(2, model.TotalElementCount); }
public void GivenAnElementIsInTheModelWhenAddElementIsCalledAgainForThatElementThenItStillHasOneElement() { DsiElementModel model = new DsiElementModel(); Assert.AreEqual(0, model.TotalElementCount); IDsiElement element1 = model.AddElement("name", "type", "source"); Assert.IsNotNull(element1); Assert.AreEqual(1, model.TotalElementCount); IDsiElement element2 = model.AddElement("name", "type", "source"); Assert.IsNull(element2); Assert.AreEqual(1, model.TotalElementCount); }
public void GivenModelIsEmptyWhenAddElementIsCalledThenItsHasOneElement() { DsiElementModel model = new DsiElementModel(); Assert.AreEqual(0, model.TotalElementCount); IDsiElement element = model.AddElement("name", "type", "source"); Assert.IsNotNull(element); Assert.AreEqual(1, model.TotalElementCount); }
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); }