You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
968 B
50 lines
968 B
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace TestUnitaire
|
|
{
|
|
public class TestEFLol
|
|
{
|
|
public void TestAddIntoDB()
|
|
{
|
|
// Arrange
|
|
ChampionEntity Zeus = new ChampionEntity
|
|
{
|
|
Name = "Zeus",
|
|
Bio = "Zeus is the king of the gods."
|
|
};
|
|
|
|
// Act
|
|
using (var context = new ChampionContext())
|
|
{
|
|
Console.WriteLine("Adding Zeus to the database...");
|
|
context.Champions.Add(Zeus);
|
|
context.SaveChanges();
|
|
}
|
|
|
|
// Assert
|
|
using (var context = new ChampionContext())
|
|
{
|
|
var champion = context.Champions.FirstOrDefault(c => c.Name == "Zeus");
|
|
if (champion == null)
|
|
{
|
|
Assert.True(false, "Champion not found in database.");
|
|
}
|
|
Assert.NotNull(champion);
|
|
Assert.Equal("Zeus", champion.Name);
|
|
Assert.Equal("Zeus is the king of the gods.", champion.Bio);
|
|
}
|
|
}
|
|
|
|
public void TestDeleteFromDB()
|
|
{
|
|
// Act
|
|
|
|
}
|
|
|
|
}
|
|
}
|