Di_Zio/Di_Zio/test/TestDecorator.cs
/// <summary>
/// Test Decorated zombie with male texture
/// </summary>
Test Decorated zombie with male texture
Test Decorated zombie with male texture
[Fact]
        public void TestMaleDecorator()
        {
            IZombieTextureDecorator zombieMale = new ZombieMaleDecorator(new ZombieModel(LIFE, SPEED, DAMAGE, TypeOfMovement.FOLLOW));
            Assert.NotNull(zombieMale);
            Assert.Equal(LIFE, zombieMale.Life);
            Assert.Equal(SPEED, zombieMale.Speed);
            Assert.Equal(DAMAGE + DAMAGE_BONUS, zombieMale.Damage);
            Assert.Equal("followingZombie", zombieMale.GetMovementStrategy());
            Texture texture = zombieMale.GetTexture();
            string value;
            if (texture.getTextureMap().TryGetValue(TypeOfTexture.IDLE, out value))
            {
                Assert.Equal("path_idle", value);
            }
            else
            {
                Assert.True(false, "Can't get IDLE TEXTURE ​​from the map");
            }
            if (texture.getTextureMap().TryGetValue(TypeOfTexture.ATTACK, out value))
            {
                Assert.Equal("path_attack", value);
            }
            else
            {
                Assert.True(false, "Can't get ATTACK TEXTURE ​​from the map");
            }
            if (texture.getTextureMap().TryGetValue(TypeOfTexture.WALK, out value))
            {
                Assert.Equal("path_walk", value);
            }
            else
            {
                Assert.True(false, "Can't get WALK TEXTURE ​​from the map");
            }
            if (texture.getTextureMap().TryGetValue(TypeOfTexture.DEAD, out value))
            {
                Assert.Equal("path_dead", value);
            }
            else
            {
                Assert.True(false, "Can't get DEAD TEXTURE ​​from the map");
            }
            Assert.False(texture.getTextureMap().TryGetValue(TypeOfTexture.JUMP, out value));
        }
[ Fact ] public void TestMaleDecorator ( ) { IZombieTextureDecorator zombieMale = new ZombieMaleDecorator ( new ZombieModel ( LIFE , SPEED , DAMAGE , TypeOfMovement . FOLLOW ) ) ; Assert . NotNull ( zombieMale ) ; Assert . Equal ( LIFE , zombieMale . Life ) ; Assert . Equal ( SPEED , zombieMale . Speed ) ; Assert . Equal ( DAMAGE + DAMAGE_BONUS , zombieMale . Damage ) ; Assert . Equal ( " " , zombieMale . GetMovementStrategy ( ) ) ; Texture texture = zombieMale . GetTexture ( ) ; string value ; if ( texture . getTextureMap ( ) . TryGetValue ( TypeOfTexture . IDLE , out value ) ) { Assert . Equal ( " " , value ) ; } else { Assert . True ( false , " } if ( texture . getTextureMap ( ) . TryGetValue ( TypeOfTexture . ATTACK , out value ) ) { Assert . Equal ( " " , value ) ; } else { Assert . True ( false , " } if ( texture . getTextureMap ( ) . TryGetValue ( TypeOfTexture . WALK , out value ) ) { Assert . Equal ( " " , value ) ; } else { Assert . True ( false , " } if ( texture . getTextureMap ( ) . TryGetValue ( TypeOfTexture . DEAD , out value ) ) { Assert . Equal ( " " , value ) ; } else { Assert . True ( false , " } Assert . False ( texture . getTextureMap ( ) . TryGetValue ( TypeOfTexture . JUMP , out value ) ) ; }
Test Decorated zombie with male texture
Test Decorated zombie with male texture