public void VoinHeroCompositeAreEqual() { string constResult = string.Format("Герой - {0}; Оружие - {1}; Движение - {2}.", new Voin().HeroName(), new Sword().Hit(), new Run().Move()); HeroFactory heroFactory = new VoinFactory(); string result; result = AF_Example.Instance.Main(heroFactory); Assert.AreEqual(constResult, result); }
static void Main(string[] args) { AbstractFactory factory = new ConcreteFactory1(); Client afClient = new Client(factory); afClient.Run(); //------------------------------------------- HeroFactory hfactory = new VoinFactory(); Hero hero = new Hero(hfactory); hero.Hit(); hero.Run(); }
public void VoinCompositeIsTrue() { HeroFactory heroFactory = new VoinFactory(); Name nameResult; Weapon weaponResult; Movement movementResult; nameResult = heroFactory.CreateName(); weaponResult = heroFactory.CreateWeapon(); movementResult = heroFactory.CreateMovement(); Assert.IsTrue(nameResult is Voin); Assert.IsTrue(weaponResult is Sword); Assert.IsTrue(movementResult is Run); }