public void ThrowsKeyNotFoundExceptionWhenTryingToFindShapeInEmptyDictionary() { // Arrange var shapeBag = new ShapeBag(); // Act | Assert Assert.Throws <KeyNotFoundException>(() => shapeBag.GetShape("triangle")); }
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); }