public void InsertWithNormalConditions() { // arrange var layerCollection = new LayerCollection(); var layer1 = new MemoryLayer() { Name = "Layer1" }; var layer2 = new MemoryLayer() { Name = "Layer2" }; var layer3 = new MemoryLayer() { Name = "Layer3" }; layerCollection.Add(layer1); layerCollection.Add(layer2); // act layerCollection.Insert(1, layer3); // assert var list = layerCollection.ToList(); Assert.AreEqual(3, list.Count()); Assert.NotNull(list[0]); Assert.AreEqual("Layer1", list[0].Name); Assert.NotNull(list[1]); Assert.AreEqual("Layer3", list[1].Name); Assert.NotNull(list[2]); Assert.AreEqual("Layer2", list[2].Name); }
public void InsertAfterRemoving() { // arrange var layerCollection = new LayerCollection(); var layer1 = new MemoryLayer() { Name = "Layer1" }; var layer2 = new MemoryLayer() { Name = "Layer2" }; var layer3 = new MemoryLayer() { Name = "Layer3" }; layerCollection.Add(layer1); layerCollection.Add(layer2); layerCollection.Remove(layer1); // act layerCollection.Insert(1, layer3); // assert var list = layerCollection.ToList(); Assert.AreEqual(2, list.Count()); Assert.NotNull(list[0]); Assert.AreEqual("Layer2", list[0].Name); Assert.NotNull(list[1]); Assert.AreEqual("Layer3", list[1].Name); }
public void MoveAfterIndex() { // arrange var layerCollection = new LayerCollection(); var layer1 = new MemoryLayer() { Name = "Layer1" }; var layer2 = new MemoryLayer() { Name = "Layer2" }; var layer3 = new MemoryLayer() { Name = "Layer3" }; layerCollection.Add(layer1); layerCollection.Add(layer2); layerCollection.Add(layer3); // act layerCollection.Move(3, layer1); // assert var list = layerCollection.ToList(); Assert.AreEqual(3, list.Count()); Assert.NotNull(list[0]); Assert.AreEqual("Layer2", list[0].Name); Assert.NotNull(list[1]); Assert.AreEqual("Layer3", list[1].Name); Assert.NotNull(list[2]); Assert.AreEqual("Layer1", list[2].Name); }