Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }