public static void StaticInstantiation() { StaticContainer.Instantiate(); StaticContainer.BindNewInstance <Weapon, HeroDefaultWeapon>(); StaticContainer.BindNewInstance <Armor, HeroDefaultArmor>(); StaticContainer.BindNewInstance <Character, Hero>(); Hero hero = (Hero)StaticContainer.Get <Character>("hero"); Console.WriteLine(string.Format("This hero has weapon with atk = {0} and armor with def = {1}.", hero.Weapon.Atk, hero.Armor.Def)); StaticContainer.Dispose(); }
public void CanInstantiate() { StaticContainer.Instantiate(); Assert.IsTrue(StaticContainer.IsInstantiated); }