Resolving problems
continuous-integration/drone/push Build is passing Details

pull/10/head
Corentin R 2 years ago
parent 014a438e96
commit 8f823252ac

@ -21,7 +21,7 @@ namespace DTO
public bool equals(ChampionDTO other)
{
return other.Name==Name && other.Bio==Bio && other.Icon==Icon;
return other.Name==this.Name && other.Bio==this.Bio && other.Icon==this.Icon;
}
public string toString()

@ -23,9 +23,9 @@ namespace EF_UT
using (var context = new LoLDbContext(options))
{
ChampionEntity chewie = new ChampionEntity("Chewbacca");
ChampionEntity yoda = new ChampionEntity("Yoda");
ChampionEntity ewok = new ChampionEntity("Ewok");
ChampionEntity chewie = new ChampionEntity("Chewbacca","","");
ChampionEntity yoda = new ChampionEntity("Yoda", "", "");
ChampionEntity ewok = new ChampionEntity("Ewok", "", "");
Console.WriteLine("Creates and inserts new Champion for tests");
@ -39,7 +39,7 @@ namespace EF_UT
using (var context = new LoLDbContext(options))
{
Assert.AreEqual(3, context.Champions.Count());
Assert.AreEqual("Chewbacca", context.Champions.First().name);
Assert.AreEqual("Chewbacca", context.Champions.First().Name);
}
}
[TestMethod]
@ -52,9 +52,9 @@ namespace EF_UT
//prepares the database with one instance of the context
using (var context = new LoLDbContext(options))
{
ChampionEntity chewie = new ChampionEntity ("Chewbacca");
ChampionEntity yoda = new ChampionEntity ("Yoda");
ChampionEntity ewok = new ChampionEntity("Ewok");
ChampionEntity chewie = new ChampionEntity ("Chewbacca", "", "");
ChampionEntity yoda = new ChampionEntity ("Yoda", "", "");
ChampionEntity ewok = new ChampionEntity("Ewok", "", "");
context.Add(chewie);
context.Add(yoda);
@ -65,22 +65,22 @@ namespace EF_UT
//prepares the database with one instance of the context
using (var context = new LoLDbContext(options))
{
string nameToFind = "ew";
Assert.AreEqual(2, context.Champions.Where(n => n.name.ToLower().Contains(nameToFind)).Count());
nameToFind = "ewo";
Assert.AreEqual(1, context.Champions.Where(n => n.name.ToLower().Contains(nameToFind)).Count());
var ewok = context.Champions.Where(n => n.name.ToLower().Contains(nameToFind)).First();
ewok.name = "Wicket";
string NameToFind = "ew";
Assert.AreEqual(2, context.Champions.Where(n => n.Name.ToLower().Contains(NameToFind)).Count());
NameToFind = "ewo";
Assert.AreEqual(1, context.Champions.Where(n => n.Name.ToLower().Contains(NameToFind)).Count());
var ewok = context.Champions.Where(n => n.Name.ToLower().Contains(NameToFind)).First();
ewok.Name = "Wicket";
context.SaveChanges();
}
//prepares the database with one instance of the context
using (var context = new LoLDbContext(options))
{
string nameToFind = "ew";
Assert.AreEqual(1, context.Champions.Where(n => n.name.ToLower().Contains(nameToFind)).Count());
nameToFind = "wick";
Assert.AreEqual(1, context.Champions.Where(n => n.name.ToLower().Contains(nameToFind)).Count());
string NameToFind = "ew";
Assert.AreEqual(1, context.Champions.Where(n => n.Name.ToLower().Contains(NameToFind)).Count());
NameToFind = "wick";
Assert.AreEqual(1, context.Champions.Where(n => n.Name.ToLower().Contains(NameToFind)).Count());
}
}
}

Loading…
Cancel
Save