Exemplo n.º 1
0
        public void ThrowArgumentNullException_WhenParamSecondWeaponIsNull()
        {
            // Arrange
            var color        = HeroColor.red;
            var stubKnifeife = new Mock <IKnife>();
            var fakeHero     = new FakeAbstractHero(color, stubKnifeife.Object);

            // Act & Assert
            Assert.ThrowsException <ArgumentNullException>(() => fakeHero.WeaponSecond = null);
        }
Exemplo n.º 2
0
        public void SetCorrectKnife_WhenParamsAreValid()
        {
            // Arrange
            var color     = HeroColor.red;
            var mockKnife = new Mock <IKnife>();
            var fakeHero  = new FakeAbstractHero(color, mockKnife.Object);

            // Act & Assert
            Assert.AreEqual(mockKnife.Object, fakeHero.WeaponSecond);
        }
Exemplo n.º 3
0
        public void SetCorrectHeroColor_WhenParamsAreValid()
        {
            // Arrange
            var color     = HeroColor.red;
            var stubKnife = new Mock <IKnife>();
            var fakeHero  = new FakeAbstractHero(color, stubKnife.Object);

            // Act & Assert
            Assert.AreEqual(color, fakeHero.HeroColor);
        }
Exemplo n.º 4
0
        public void SetCorrectNewValues_When_MovingDown()
        {
            // Arrange
            var down            = 4;
            var color           = HeroColor.red;
            var stubKnife       = new Mock <IKnife>();
            var fakeHero        = new FakeAbstractHero(color, stubKnife.Object);
            var currentPosition = fakeHero.PositionX;

            // Act
            fakeHero.Move(down);

            // Assert
            Assert.AreEqual(currentPosition + 1, fakeHero.PositionX);
        }
Exemplo n.º 5
0
        public void SetCorrectNewValues_WhenMovingRight()
        {
            // Arrange
            var right           = 2;
            var color           = HeroColor.red;
            var stubKnife       = new Mock <IKnife>();
            var fakeHero        = new FakeAbstractHero(color, stubKnife.Object);
            var currentPosition = fakeHero.PositionY;

            // Act
            fakeHero.Move(right);

            // Assert
            Assert.AreEqual(currentPosition + 1, fakeHero.PositionY);
        }
        public void ToStringReturnCorrectInfo()
        {
            // Arrange
            var color      = HeroColor.red;
            var stubKnife  = new Mock <IKnife>();
            var stubWeapon = new Mock <IWeapon>();
            var fakeHero   = new FakeAbstractHero(color, stubKnife.Object);

            fakeHero.Weapon = stubWeapon.Object;

            var expectedInfo = $"Hero Hp: {fakeHero.Hp}, Name: {fakeHero.Name}, Class: { fakeHero.GetType().Name}\n" +
                               $"{fakeHero.Additionalinfo()}\n" +
                               $"Hero Weapon:{fakeHero.Weapon.ToString()}\nHero Secret Weapon:{fakeHero.WeaponSecond.ToString()}";

            // Act & Assert
            Assert.AreEqual(expectedInfo, fakeHero.ToString());
        }
Exemplo n.º 7
0
        public void SetCorrectData_WhenParamsAreValid()
        {
            // Arrange
            var color     = HeroColor.red;
            var stubKnife = new Mock <IKnife>();

            // Act
            var fakeHero = new FakeAbstractHero(color, stubKnife.Object);

            // Assert
            Assert.AreEqual("Telerik", fakeHero.Name);
            Assert.AreEqual(1, fakeHero.PositionX);
            Assert.AreEqual(1, fakeHero.PositionY);
            Assert.AreEqual(450, fakeHero.Hp);
            Assert.AreEqual(1, fakeHero.Level);
            Assert.AreEqual(0, fakeHero.Exp);
        }