Example #1
0
 public Soldier(string _name, int _age, Genders _gender, int _damage, int _armour, int _speed, Qualities _quality, Kingdoms _banner) : base(_name, _age, _gender)
 {
     Number++;
     Seqnumber = Number;
     Damage    = _damage;
     Armor     = _armour;
     Speed     = _speed;
     Tier      = (Damage + Armor) / 40;
     Quality   = _quality;
     Banner    = _banner;
     IsAlive   = true;
 }
Example #2
0
        public void When_NoEmblemDefined_Expect_KeyNotFoundException(Kingdoms testKingdom)
        {
            // Arrange
            var emblem = GameEngine.Emblems[testKingdom];

            GameEngine.Emblems.Remove(testKingdom);

            // Assert
            var ex1 = Assert.Throws <KeyNotFoundException>(() => new GameEngine(consoleMethods));

            // Revert
            GameEngine.Emblems.Add(testKingdom, emblem);
        }
Example #3
0
        public void When_RulerAndValidInput_Expect_KingdomName(string input, Kingdoms rulingKingdom)
        {
            // Arrange
            var testGameEngine = new GameEngine(consoleMethods);

            testGameEngine.RulingKingdom = testGameEngine.AllKingdoms[rulingKingdom];

            // Act
            var actual = testGameEngine.ProcessInput(input.Trim().ToLower());

            // Assert
            Assert.AreEqual(rulingKingdom.ToString(), actual);
        }
Example #4
0
        public void When_SendValidMessage_Expect_AllyAdded(Kingdoms sendingKingdom, Kingdoms receivingKingdom)
        {
            // Arrange
            var testGameEngine = new GameEngine(consoleMethods);
            var message        = new Message(sendingKingdom, receivingKingdom, testGameEngine.AllKingdoms[receivingKingdom].Emblem);

            // Act
            testGameEngine.AllKingdoms[sendingKingdom].SendMessage(testGameEngine.AllKingdoms[receivingKingdom], message);

            // Assert
            Assert.AreEqual(testGameEngine.AllKingdoms[sendingKingdom].Allies.FirstOrDefault(), receivingKingdom);
            Assert.AreEqual(testGameEngine.AllKingdoms[receivingKingdom].Allies.FirstOrDefault(), sendingKingdom);
        }
Example #5
0
        // CONSTRUCTORS
        public Soldier() : base()
        {
            Number++;
            Seqnumber = Number;
            Random rand = new Random((int)DateTime.Now.Ticks);

            Name    = Names[(Number + rand.Next(0, 10)) % 11];
            Damage  = rand.Next(30, 115);
            Armor   = rand.Next(10, 55);
            Speed   = rand.Next(10, 55);
            Tier    = (Damage + Armor) / 40;
            Quality = Qualities.Legendary;
            Banner  = Kingdoms.Empire;
            Curhp   = Hp;
            IsAlive = true;
            Thread.Sleep(1);
        }
        public void When_ValidKingdomAndMessage_Expect_AllianceMade(string input, Kingdoms kingdom)
        {
            // Arrange
            var aGoldenCrown   = new AGoldenCrown();
            var testGameEngine = new GameEngine(consoleMethods);

            // we cure the input as the user input is being converted to lower and
            // trimmed when being read from the console in the actual application
            input = input.ToLower().Trim();

            // Act
            aGoldenCrown.CustomInputAction(input, testGameEngine);

            // Assert
            Assert.That(testGameEngine.AllKingdoms[competingKingdom].Allies.Contains(kingdom) &&
                        testGameEngine.AllKingdoms[kingdom].Allies.Contains(competingKingdom));
        }
Example #7
0
 public Legionary(string name, int age, Genders gender, int damage, int armour, int speed, int shieldArmour, Qualities quality, Kingdoms banner) : base(name, age, gender, damage, armour, speed, quality, banner)
 {
     this.shieldArmour = shieldArmour;
 }
Example #8
0
 public Spearman(string name, int age, Genders gender, int damage, int armour, int speed, int spearLength, Qualities quality, Kingdoms banner) : base(name, age, gender, damage, armour, speed, quality, banner)
 {
     this.spearLength = spearLength;
 }
Example #9
0
 public Cataphract(string name, int age, Genders gender, int damage, int armour, int speed, int horseSpeed, Qualities quality, Kingdoms banner) : base(name, age, gender, damage, armour, speed, quality, banner)
 {
     this.horseSpeed = horseSpeed;
 }
Example #10
0
 public Kingdom(Kingdoms kingdom, string emblem)
 {
     Name   = kingdom;
     Emblem = emblem;
     Allies = new List <Kingdoms>();
 }
Example #11
0
 public Message(Kingdoms sender, Kingdoms recipient, string secretMessage)
 {
     Sender    = sender;
     Recipient = recipient;
     Text      = secretMessage;
 }