Exemplo n.º 1
0
        private IEnumerable <SpecialAbility> GetStrongestAvailableAbilities(IEnumerable <SpecialAbility> availableAbilities)
        {
            var strongestAbilities = new List <SpecialAbility>();

            foreach (var ability in availableAbilities)
            {
                //INFO: This means it is a custom special ability
                if (!specialAbilityDataSelector.IsSpecialAbility(ability.Name))
                {
                    strongestAbilities.Add(ability);
                    continue;
                }

                var alreadyAdded = strongestAbilities.Any(a => a.BaseName == ability.BaseName && a.Power == ability.Power && a.Name == ability.Name);
                if (alreadyAdded)
                {
                    continue;
                }

                var max = availableAbilities.Where(a => a.BaseName == ability.BaseName).Max(a => a.Power);

                if (ability.Power == max)
                {
                    strongestAbilities.Add(ability);
                }
            }

            return(strongestAbilities);
        }
        public void IsSpecialAbility()
        {
            mockInnerSelector.Setup(s => s.IsCollection(TableNameConstants.Collections.Set.SpecialAbilityAttributes, "name")).Returns(true);
            var isSpecialAbility = selector.IsSpecialAbility("name");

            Assert.That(isSpecialAbility, Is.True);
        }