Exemplo n.º 1
0
        public void Hit_WithKatana_HitsDamage7_WithoutNinject()
        {
            var weapon = new Katana();
            var loger = new FakeLogger();
            Samurai samurai = new Samurai(weapon, loger, helmet: new Helmet());

            var damage = samurai.Hit();

            Assert.AreEqual(7, damage);
        }
Exemplo n.º 2
0
        public void Hit_WithKatana_LogIt()
        {
            var fakeLogger = new FakeLogger();
            Kernel.Bind<IWeapon>().To<Katana>();
            Kernel.Bind<IHelmet>().ToConstant(new Helmet());
            Kernel.Bind<ILogger>().ToConstant(fakeLogger);

            var samurai = Kernel.Get<Samurai>();

            var damage = samurai.Hit();

            Assert.IsTrue(fakeLogger.LogInvoked);
        }