|
|
|
@ -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());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|