示例#1
0
        public void GenericErrorResult_AssertionCallbackIsCalled()
        {
            var  input     = ActResult.ThrewException <int>(new Exception());
            var  underTest = new Acted <int>(input);
            bool called    = false;

            underTest.Assert(r => called = true);

            Assert.IsTrue(called);
        }
示例#2
0
        public void OkResult_EmptyAssertReturnsAssertionRoot()
        {
            var input     = ActResult.Ok();
            var underTest = new Acted(input);

            var result = underTest.Assert();

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(AssertionRoot));
        }
示例#3
0
        public void GenericOkResult_AssertionCallbackIsCalled()
        {
            var  input     = ActResult.Ok(1);
            var  underTest = new Acted <int>(input);
            bool called    = false;

            underTest.Assert(r => called = true);

            Assert.IsTrue(called);
        }
示例#4
0
        public void GenericErrorResult_EmptyAssertReturnsAssertionRoot()
        {
            var input     = ActResult.ThrewException <int>(new Exception());
            var underTest = new Acted <int>(input);

            var result = underTest.Assert();

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(AssertionRoot));
        }
示例#5
0
        public void Act()
        {
            var creaturesToDelete = new List <ICreature>();

            foreach (var e in playerCreaturesInGame)
            {
                var player  = e.Key;
                var enemies = GetEnemiesOf(player);

                foreach (var creature in e.Value)
                {
                    if (creature.IsAlive())
                    {
                        creature.Act(enemies);
                    }
                    else
                    {
                        creaturesToDelete.Add(creature);
                    }
                }
            }

            if (IsFinished())
            {
                var winner = GetWinner();
                winner.GameGoldAmount += CurrentLevel.ReceivedGoldAmount;
                winner.PlayerLevelInfo.CurrentExperienceAmount += CurrentLevel.ReceivedExperienceAmount;

                ChangeState(GameStage.Finished);
            }

            foreach (var creature in creaturesToDelete)
            {
                DeleteCreatureFromField(creature);
            }

            Acted?.Invoke();
        }
示例#6
0
 public void UpdateState(MemeController controller)
 {
     DoActions(controller);
     Acted?.Invoke();
     CheckTransitions(controller);
 }
示例#7
0
 public void Invoke(MemeController memeController)
 {
     _func?.Invoke(memeController);
     Acted?.Invoke(this);
 }