コード例 #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);
            MatchRandomizer.Current = randomizerStub.Object;

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

            action = new PassAction();
            action.Perform(match);
        }
コード例 #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.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);
        }