コード例 #1
0
        public IEnumerator SpellCardTimeOutTest()
        {
            bool isSpellCardFinished = false;
            EventHandler <EventArgs> OnSpellCardTimeOut = (o, s) => isSpellCardFinished = true;

            SpellCard       testSpellCard              = DataInjectorTestHelerMethod.GetTestSpellCard(2).GetComponent <SpellCard>();
            IEnemyComponent testSpellCardComponent     = testSpellCard.IntializeEnemyComponent();
            SpellCard       testSpellCardComponentCast = (SpellCard)testSpellCardComponent;

            testSpellCardComponentCast.OnEnemyFinished += OnSpellCardTimeOut;
            testSpellCardComponentCast.ActiveEnemyComponent();

            yield return(new WaitForSecondsRealtime(3.05f));

            Assert.That(isSpellCardFinished);
        }
コード例 #2
0
        public IEnumerator SpellCardDefeatedTest()
        {
            bool isSpellCardFinished = false, isSpellCardEnded = false;
            EventHandler <EventArgs> onSpellCardFinished = (o, s) => isSpellCardFinished = true;
            EventHandler <EventArgs> onSpellCardEnded    = (o, s) => isSpellCardEnded = true;

            SpellCard       testSpellCard                = DataInjectorTestHelerMethod.GetTestSpellCard(1).GetComponent <SpellCard>();
            IEnemyComponent testSpellCardComponent       = testSpellCard.IntializeEnemyComponent();
            SpellCard       testSpellCardComponentCast   = (SpellCard)testSpellCardComponent;

            testSpellCardComponentCast.OnEnemyFinished += onSpellCardFinished;
            testSpellCardComponentCast.OnEnemyEnd      += onSpellCardEnded;
            testSpellCardComponentCast.ActiveEnemyComponent();

            yield return(new WaitForSecondsRealtime(1.5f));

            testSpellCardComponentCast.Health.DecreseHealth(100);

            testSpellCardComponentCast.DeactiveEnemyComponent();

            Debug.Log($"{isSpellCardFinished.ToString()} {isSpellCardEnded.ToString()}");
            Assert.That(isSpellCardFinished && isSpellCardEnded);
        }