Exemplo n.º 1
0
        public void ThrowsKeyNotFoundExceptionWhenTryingToFindShapeInEmptyDictionary()
        {
            // Arrange
            var shapeBag = new ShapeBag();

            // Act | Assert
            Assert.Throws <KeyNotFoundException>(() => shapeBag.GetShape("triangle"));
        }
Exemplo n.º 2
0
        public void GetsShapeByNameFromDictionary(string name, Type expected)
        {
            // Arrange
            var shapeBag = new ShapeBag();

            shapeBag.AddShape("triangle", new Triangle());
            shapeBag.AddShape("rectangle", new Rectangle());

            // Act
            var shape = shapeBag.GetShape(name);

            // Assert
            Assert.IsInstanceOf(expected, shape);
        }