public void ShapesRepository_Remove_RemoveAll_Test() { Polygon polygon1 = new Polygon(); Polygon polygon2 = new Polygon(); Polygon polygon3 = new Polygon(); ShapesRepository arr = new ShapesRepository(); arr.Add(polygon1); arr.Add(polygon2); arr.Remove(polygon2); Assert.AreEqual(1, arr.Polygons.Count); arr.Add(polygon2); arr.Add(polygon3); arr.RemoveAll(); Assert.AreEqual(0, arr.Polygons.Count); }
public void ShapesRepository_GetAll_Test() { Polygon polygon1 = new Polygon(); Polygon polygon2 = new Polygon(); polygon2.StrokeThickness = 2; polygon1.HorizontalAlignment = HorizontalAlignment.Left; ShapesRepository arr = new ShapesRepository(); arr.Add(polygon1); arr.Add(polygon2); List <Polygon> pol = arr.GetAll().ToList(); Assert.AreEqual(2, pol[1].StrokeThickness); Assert.AreEqual(HorizontalAlignment.Left, pol[0].HorizontalAlignment); }
public void ShouldRemoveShape() { const int expectedCount = 0; var shapeRepo = new ShapesRepository(); shapeRepo.GetShapes().Clear(); var shape = new Triangle(); shapeRepo.AddShape(shape); shapeRepo.RemoveShape(shape); var shapesFromRepo = shapeRepo.GetShapes(); shapesFromRepo.Count.Should().Be(expectedCount); }
public void ShapesRepository_Add_AddRange_Test() { Polygon polygon1 = new Polygon(); Polygon polygon2 = new Polygon(); Polygon polygon3 = new Polygon(); Polygon polygon4 = new Polygon(); List <Polygon> list = new List <Polygon>(); list.Add(polygon3); list.Add(polygon4); ShapesRepository arr = new ShapesRepository(); arr.Add(polygon1); arr.Add(polygon2); Assert.AreEqual(2, arr.Polygons.Count); arr.AddRange(list); Assert.AreEqual(4, arr.Polygons.Count); }
public void ShouldAddShape() { const int expectedCount = 1; var shapeRepo = new ShapesRepository(); shapeRepo.GetShapes().Clear(); var shape = new Triangle(); shapeRepo.MonitorEvents(); shapeRepo.AddShape(shape); var shapesFromRepo = shapeRepo.GetShapes(); shapeRepo.ShouldRaise(nameof(shapeRepo.ShapeAdded)); shapesFromRepo.Count.Should().Be(expectedCount); shapesFromRepo.First().Should().Be(shape); }
public void ShouldNotRemoveAnyShape() { const int expectedCount = 1; var shapeRepo = new ShapesRepository(); shapeRepo.GetShapes().Clear(); var shape = new Triangle(); var shape2 = new Square(); shapeRepo.AddShape(shape); shapeRepo.RemoveShape(shape2); shapeRepo.RemoveShape(null); var shapesFromRepo = shapeRepo.GetShapes(); shapesFromRepo.Count.Should().Be(expectedCount); shapesFromRepo.First().Should().Be(shape); }
private void Awake() { Instance = this; }
public DesignerController(ShapesRepository repository) { _repository = repository; }