Skip to content

Commit

Permalink
Cambio en tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasdcl committed Nov 7, 2024
1 parent e7eee36 commit be930ae
Show file tree
Hide file tree
Showing 16 changed files with 95 additions and 193 deletions.
12 changes: 12 additions & 0 deletions src/Library/Attack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ public class Attack : IAttack

public Attack(string name, Type type, int Accuracy, int Power)
{
if (string.IsNullOrEmpty(name))
{
throw new ArgumentException("El nombre ingresado no es válido");
}
if (Accuracy < 0 || Accuracy > 1)
{
throw new ArgumentException("La precision ingresada no es válido");
}
if (Power < 0)
{
throw new ArgumentException("El poder ingresado no es válido");
}
this.Name = name;
this.Type = type;
this.Accuracy = Accuracy;
Expand Down
47 changes: 47 additions & 0 deletions test/LibraryTests/AttackTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using Library;
using NUnit.Framework;
namespace LibraryTests;


public class AttackTest
{
[SetUp]
public void Setup()
{
}

[Test]
public void TestAccuracy0()
{
Attack attack = new Attack("impactrueno",Library.Type.Electric, 0, 100);
Assert.That(attack.Accuracy.Equals(0));
}

[Test]
public void TestPower0()
{
Attack attack = new Attack("impactrueno",Library.Type.Electric, 1, 0);
Assert.That(attack.Power.Equals(0));
}

[Test]
public void TestNullName()
{
Attack attack;
Assert.That(new Attack("",Library.Type.Electric, 1, 30).Equals("El nombre ingresado no es válido"));
}

[Test]
public void TestInvalidAccuracy()
{
Attack attack;
Assert.That(new Attack("impactrueno",Library.Type.Electric, 70000, 30).Equals("La precision ingresada no es válido"));
}

[Test]
public void TestInvalidPower()
{
Attack attack;
Assert.That(new Attack("",Library.Type.Electric, 1, -80000).Equals("El poder ingresado no es válido"));
}
}
4 changes: 3 additions & 1 deletion test/LibraryTests/GameTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
using Library;
using NUnit.Framework;
Expand All @@ -21,4 +22,5 @@ public void TestMetodo1()
game.NextTurn();
Assert.That(1, Is.EqualTo(game.TurnCount));
}
}
}
*/
10 changes: 8 additions & 2 deletions test/LibraryTests/PlayerTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
using Library;
using NUnit.Framework;
Expand All @@ -14,12 +15,14 @@ public class PlayerTest
[SetUp]
public void SetUp()
{
player = new Player("jugador1");
charizard1 = new Charizard();
charizard2 = new Charizard();

}
[Test]
public void TestAddToTeam()
{
Expand All @@ -29,9 +32,12 @@ public void TestAddToTeam()
Assert.That(player.PokemonTeam.Count, Is.EqualTo(2));
}
[Test]
public void TestChangeActivePokemon()
{
Assert.That(player.ActivePokemon,Is.EqualTo(charizard1));
}
}
}
*/
25 changes: 25 additions & 0 deletions test/LibraryTests/SpecialAttackTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Library;
using NUnit.Framework;

namespace LibraryTests;

[TestFixture]
[TestOf(typeof(Game))]
public class SpecialAttackTest
{
[SetUp]
public void Setup()
{
}

[Test]
public void TestSpecialAttack()
{
Charizard charizard = new Charizard();
SpecialAttack lanzallamas = new SpecialAttack("lanzallamas", Library.Type.Fire, 1, 40, Library.State.Burned);
Gengar gengar = new Gengar();
DamageCalculator.CalculateDamage(gengar,lanzallamas);
Assert.That(lanzallamas.SpecialEffect.Equals(gengar.CurrentState));

}
}
20 changes: 0 additions & 20 deletions test/LibraryTests/UserStoriesTests/UserStory1.cs

This file was deleted.

17 changes: 0 additions & 17 deletions test/LibraryTests/UserStoriesTests/UserStory10.cs

This file was deleted.

17 changes: 0 additions & 17 deletions test/LibraryTests/UserStoriesTests/UserStory11.cs

This file was deleted.

17 changes: 0 additions & 17 deletions test/LibraryTests/UserStoriesTests/UserStory2.cs

This file was deleted.

17 changes: 0 additions & 17 deletions test/LibraryTests/UserStoriesTests/UserStory3.cs

This file was deleted.

17 changes: 0 additions & 17 deletions test/LibraryTests/UserStoriesTests/UserStory4.cs

This file was deleted.

17 changes: 0 additions & 17 deletions test/LibraryTests/UserStoriesTests/UserStory5.cs

This file was deleted.

17 changes: 0 additions & 17 deletions test/LibraryTests/UserStoriesTests/UserStory6.cs

This file was deleted.

17 changes: 0 additions & 17 deletions test/LibraryTests/UserStoriesTests/UserStory7.cs

This file was deleted.

17 changes: 0 additions & 17 deletions test/LibraryTests/UserStoriesTests/UserStory8.cs

This file was deleted.

17 changes: 0 additions & 17 deletions test/LibraryTests/UserStoriesTests/UserStory9.cs

This file was deleted.

0 comments on commit be930ae

Please sign in to comment.