public int HasCustomer() { int i = 0; CompanyContext context = new CompanyContext(); foreach (var customer in context.listCustomer) { i++; } return i; }
public void InsertionFonctionnelle() { Database.SetInitializer(new DropCreateDatabaseAlways<CompanyContext>()); CompanyContext Context = new CompanyContext(); Customer client = new Customer() { AccountBalance = 125.36, AdresseLine2 = "n°25", AdressLine1 = "rue du haaa", City = "Bruxelles", EMail="*****@*****.**", Name="machin", PostCode = "1000", Remark = "bla,bla,bla" }; Context.listCustomer.Add(client); Context.SaveChanges(); Assert.AreEqual(1, HasCustomer()); }