diff --git a/Sources/DTO/ChampionDTO.cs b/Sources/DTO/ChampionDTO.cs index 5c0344b..ddef07e 100644 --- a/Sources/DTO/ChampionDTO.cs +++ b/Sources/DTO/ChampionDTO.cs @@ -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() diff --git a/Sources/EF_UT/EntityTest.cs b/Sources/EF_UT/EntityTest.cs index 45716d8..4d4ce34 100644 --- a/Sources/EF_UT/EntityTest.cs +++ b/Sources/EF_UT/EntityTest.cs @@ -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()); } } }