public void AddNewWorkerByClient() { ShapeFactory factory = new ShapeFactory(); factory.AddWorker(new SquareFactoryWorker()); IShape square = factory.Create("Square", 12.0); Assert.IsNotNull(square); Assert.That(square.GetArea(), Is.EqualTo(144.0)); }
public void Test2() { ShapeFactory factory = new ShapeFactory(); IShape square = factory.CreateShape("Square", 2); factory.AddWorker(new TriangleWorker()); IShape triangle = factory.CreateShape("Triangle", 2, 3, 4); Assert.IsNotNull(square); Assert.IsNotNull(triangle); Assert.AreNotEqual(triangle, square); }