Exemple #1
0
        /// <summary>
        /// add a new character to this account, if the newly created character abides to some rules
        /// </summary>
        /// <param name="name">name of the character</param>
        /// <param name="level">level of the character</param>
        /// <param name="race">race of the character</param>
        /// <param name="faction">faction of the character</param>
        /// <param name="class">class of the character</param>
        /// <returns>return true if the creation wnet smoothly</returns>
        public bool AddNewCharacter(Guid id, string name, int level, Race race, Faction faction, Class @class)
        {
            var newCharacter = new Character()
            {
                Id = id,
                Name = name,
                Level = level,
                Race = race,
                Faction = faction,
                Class = @class
            };

            if ( CharacterSpecifications.Factions
                            .And(CharacterSpecifications.DruidSpecifications)
                            .And(CharacterSpecifications.BloodElfSpecifications)
                            .IsSatisfiedBy(newCharacter)
                            && AccountSpecifications.DeathKnightSpecifications(newCharacter)
                            .IsSatisfiedBy(this))
            {
                Characters.Add(newCharacter);
                return true;
            }
            else
                return false;
        }
        public IRepoAccount createFakeRepoAccount(Guid wowId, Guid wowId2)
        {
            var orgrimm = new Character() { Id = Guid.NewGuid(), Name = "Orgrim Doomhammer", Class = ClassFactory.Warrior, Faction = FactionFactory.Horde, Level = 100, Race = RaceFactory.Orc };
            var cairne = new Character() { Id = Guid.NewGuid(), Name = "Cairne Bloodhoof", Class = ClassFactory.Druid, Faction = FactionFactory.Horde, Level = 100, Race = RaceFactory.Tauren };
            var Lorthemar = new Character() { Id = Guid.NewGuid(), Name = "Lor'themar Theron", Class = ClassFactory.Mage, Faction = FactionFactory.Horde, Level = 100, Race = RaceFactory.BloodElf };

            var wowAccount = new Account() { Id = wowId, Characters = new List<Character>() { orgrimm, Lorthemar } };
            var wow2Account = new Account() { Id = wowId2, Characters = new List<Character>() { cairne } };

            var ds = new Dictionary<Guid, Account>() { { wowId, wowAccount }, { wowId2, wow2Account } };

            return new MemoryRepoAccount(ds);
        }