public void Prototype1() { ConcretePrototype1 prototype = new ConcretePrototype1(); ConcretePrototype1 clone = (ConcretePrototype1)prototype.Clone(); int value = clone.Value1; Assert.Equal(value, prototype.Value1); }
//Прототип - Prototype public Run Prototype() { Console.WriteLine("\nPrototype:"); // Create two instances and clone each Patterns.Creational.Prototype.Prototype p1 = new ConcretePrototype1("I"); Patterns.Creational.Prototype.Prototype c1 = p1.Clone(); Console.WriteLine("Cloned: {0}", c1.Id); Patterns.Creational.Prototype.Prototype p2 = new ConcretePrototype2("II"); Patterns.Creational.Prototype.Prototype c2 = p2.Clone(); Console.WriteLine("Cloned: {0}", c2.Id); return this; }