Skip to content

Commit

Permalink
Agregue Pokemon v1 y Catalog v1
Browse files Browse the repository at this point in the history
  • Loading branch information
macarenapineiro committed Oct 8, 2024
1 parent c647fc5 commit 5bc21eb
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/Library/Catalog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace ClassLibrary;

public class Catalog

Check warning on line 3 in src/Library/Catalog.cs

View workflow job for this annotation

GitHub Actions / build-test-generate-docs

Missing XML comment for publicly visible type or member 'Catalog'
{
private List<Pokemon> pokemons = new List<Pokemon>();

public Catalog()

Check warning on line 7 in src/Library/Catalog.cs

View workflow job for this annotation

GitHub Actions / build-test-generate-docs

Missing XML comment for publicly visible type or member 'Catalog.Catalog()'
{
Pokemon pikachu = new Pokemon();
pikachu.Name = "Pikachu";
this.pokemons.Add(pikachu);
}

public Pokemon FindPokemonByName(string name)

Check warning on line 14 in src/Library/Catalog.cs

View workflow job for this annotation

GitHub Actions / build-test-generate-docs

Missing XML comment for publicly visible type or member 'Catalog.FindPokemonByName(string)'
{
foreach (var pokemon in this.pokemons)
{
if (pokemon.Name == name)
{
return pokemon;
}
}

return null;
}
}
6 changes: 6 additions & 0 deletions src/Library/Pokemon.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace ClassLibrary;

public class Pokemon

Check warning on line 3 in src/Library/Pokemon.cs

View workflow job for this annotation

GitHub Actions / build-test-generate-docs

Missing XML comment for publicly visible type or member 'Pokemon'
{
public string Name { get; set; }

Check warning on line 5 in src/Library/Pokemon.cs

View workflow job for this annotation

GitHub Actions / build-test-generate-docs

Missing XML comment for publicly visible type or member 'Pokemon.Name'
}
28 changes: 28 additions & 0 deletions test/LibraryTests/CatalogTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using NUnit.Framework;

namespace Tests;

using ClassLibrary;

public class CatalogTests

Check warning on line 7 in test/LibraryTests/CatalogTests.cs

View workflow job for this annotation

GitHub Actions / build-test-generate-docs

Missing XML comment for publicly visible type or member 'CatalogTests'
{
[Test]
public void FindPokemonByName_WhenPokemonDoesNotExists_ReturnNull()

Check warning on line 10 in test/LibraryTests/CatalogTests.cs

View workflow job for this annotation

GitHub Actions / build-test-generate-docs

Missing XML comment for publicly visible type or member 'CatalogTests.FindPokemonByName_WhenPokemonDoesNotExists_ReturnNull()'

Check warning on line 10 in test/LibraryTests/CatalogTests.cs

View workflow job for this annotation

GitHub Actions / build-test-generate-docs

Remove the underscores from member name Tests.CatalogTests.FindPokemonByName_WhenPokemonDoesNotExists_ReturnNull() (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1707)
{
Catalog catalog = new Catalog();

Pokemon pokemon = catalog.FindPokemonByName("Otro pokemon");

Assert.That(pokemon, Is.Null);
}

[Test]
public void FindPokemonByName_WhenPokemonExists_ReturnPokemon()

Check warning on line 20 in test/LibraryTests/CatalogTests.cs

View workflow job for this annotation

GitHub Actions / build-test-generate-docs

Missing XML comment for publicly visible type or member 'CatalogTests.FindPokemonByName_WhenPokemonExists_ReturnPokemon()'

Check warning on line 20 in test/LibraryTests/CatalogTests.cs

View workflow job for this annotation

GitHub Actions / build-test-generate-docs

Remove the underscores from member name Tests.CatalogTests.FindPokemonByName_WhenPokemonExists_ReturnPokemon() (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1707)
{
Catalog catalog = new Catalog();

Pokemon pokemon = catalog.FindPokemonByName("Pikachu");

Assert.That(pokemon.Name, Is.EqualTo("Pikachu"));
}
}

0 comments on commit 5bc21eb

Please sign in to comment.