Exemplo n.º 1
0
        public override void SetUp()
        {
            base.SetUp();

            var mocks = new MockRepository(MockBehavior.Loose);
            var randomizerStub = mocks.Create<MatchRandomizer>(MockBehavior.Loose, new StaticRandomGenerator());
            randomizerStub.Setup(r => r.TryPass(It.IsAny<double>(), It.IsAny<double>(), It.IsAny<double>())).Returns(true);
            randomizerStub.Setup(r => r.TryShoot(It.IsAny<double>(), It.IsAny<double>(), It.IsAny<double>())).Returns(ShotResult.Scored);
            MatchRandomizer.Current = randomizerStub.Object;

            match = A.Match.Build();
            match.InitiateAttack(match.Team2.Squad.ElementAt(5));

            var pass = new PassAction();
            pass.Perform(match);

            previousShooterRating = match.CurrentPlayer.Rating;
            previousAssistantRating = match.PreviousPlayer.Rating;

            action = new ShootAction();
            action.Perform(match);
        }
Exemplo n.º 2
0
        public override void SetUp()
        {
            base.SetUp();

            var mocks = new MockRepository(MockBehavior.Loose);
            var randomizerStub = mocks.Create<MatchRandomizer>(MockBehavior.Loose, new StaticRandomGenerator());
            randomizerStub.Setup(r => r.TryShoot(It.IsAny<double>(), It.IsAny<double>(), It.IsAny<double>())).Returns(ShotResult.Missed);
            MatchRandomizer.Current = randomizerStub.Object;

            Match match = A.Match.Build();
            match.InitiateAttack(match.Team1.Squad.ElementAt(5));

            action = new ShootAction();
            action.Perform(match);
        }