Exemplo n.º 1
0
            public void WhenEnemyIsNotLive_NullIsReturned(EnemyStatus enemyStatus)
            {
                var wave1 = Substitute.For <IEnemySet>();

                wave1.Status.Returns(EnemySetStatus.Spawning);
                MockEnemy first = new MockEnemy(10, 0, 100, enemyStatus);

                wave1.Enemies.Returns(new List <Enemy> {
                    first
                });

                var actual = Weapon <MockWeaponSettings> .GetEnemyMostNearTheEndAndInTrackingRange(Vector2.Zero, new IEnemySet[] { wave1 }, 17, 12);

                Assert.That(actual.HasValue, Is.False);
            }
Exemplo n.º 2
0
            public void WhenTwoEnemiesInTrackingRange_NearestToEndIsReturned()
            {
                var wave1 = Substitute.For <IEnemySet>();

                wave1.Status.Returns(EnemySetStatus.Spawning);
                MockEnemy first  = new MockEnemy(10, 0, 100);
                MockEnemy second = new MockEnemy(15, 0, 50);

                wave1.Enemies.Returns(new List <Enemy> {
                    first,
                    second
                });

                var actual = Weapon <MockWeaponSettings> .GetEnemyMostNearTheEndAndInTrackingRange(Vector2.Zero, new IEnemySet[] { wave1 }, 17, 12);

                Assert.That(actual.Value.Enemy, Is.SameAs(second));
            }