Пример #1
0
        public void IfThereAreNoBullets_ShootFail()
        {
            Mock<IFire> fireControllerMock = new Mock<IFire>();

            GunController controller = new GunController();
            controller.bulletsLeft = 0;
            controller.fireController = fireControllerMock.Object;

            controller.ApplyFire();

            fireControllerMock.Verify(c => c.Fire(), Times.Never);
        }
Пример #2
0
        public void IfThereAreNoBullets_ShootFail()
        {
            Mock <IFire> fireControllerMock = new Mock <IFire>();

            GunController controller = new GunController();

            controller.bulletsLeft    = 0;
            controller.fireController = fireControllerMock.Object;

            controller.ApplyFire();

            fireControllerMock.Verify(c => c.Fire(), Times.Never);
        }
Пример #3
0
        public void IfThereAreBulletsAShootSucceed()
        {
            Mock<IFire> fireControllerMock = new Mock<IFire>();

            GunController controller = new GunController();
            controller.fireController = fireControllerMock.Object;

            controller.ApplyFire();

            Assert.AreEqual(4, controller.bulletsLeft);

            fireControllerMock.Verify(c => c.Fire());
        }
Пример #4
0
        public void IfThereAreBulletsAShootSucceed()
        {
            Mock <IFire> fireControllerMock = new Mock <IFire>();

            GunController controller = new GunController();

            controller.fireController = fireControllerMock.Object;

            controller.ApplyFire();

            Assert.AreEqual(4, controller.bulletsLeft);

            fireControllerMock.Verify(c => c.Fire());
        }