private void DeleteSomeUsers(int startId, int count) { using (var db = new AjourBTForTestContext()) { for (int id = 0; id < count; id++) { Employee emp = db.Employees.ToList().LastOrDefault(); db.Employees.Remove(emp); db.SaveChanges(); } } }
public void TeardownTest() { if (Browser.HasElement("Log off")) { Browser.ClickOnLink("Log off"); } string[] comments = { "TestComment1", "TestComment2" }; using (var db = new AjourBTForTestContext()) { foreach (var item in comments) { BusinessTrip btToRemove = db.BusinessTrips.Where(bt => bt.AccComment == item).FirstOrDefault(); db.BusinessTrips.Remove(btToRemove); } db.SaveChanges(); } }
private void BTSetup() { btList = new List <BusinessTrip> { new BusinessTrip { AccComment = "TestComment1", BusinessTripID = 100, EmployeeID = 12, EndDate = new DateTime(2014, 06, 21), Manager = "ncru", StartDate = new DateTime(2014, 05, 06), Status = BTStatus.Confirmed | BTStatus.Reported, Responsible = "abcd", LastCRUDTimestamp = new DateTime(2014, 01, 01), LocationID = 1, UnitID = 1 }, new BusinessTrip { AccComment = "TestComment2", BusinessTripID = 101, EmployeeID = 13, EndDate = new DateTime(2016, 01, 01), Manager = "ncru", StartDate = new DateTime(2015, 06, 07), Status = BTStatus.Confirmed | BTStatus.Reported, Responsible = "abcd", LastCRUDTimestamp = new DateTime(2014, 01, 01), LocationID = 2, UnitID = 1 }, }; using (var db = new AjourBTForTestContext()) { foreach (BusinessTrip item in btList) { db.BusinessTrips.Add(item); db.SaveChanges(); } } }
private void AddSomeUsers() { List <Employee> usersToAdd = new List <Employee> { new Employee { EmployeeID = 86, FirstName = "Gerasum", LastName = "Mumu", DepartmentID = 2, EID = "gemu", IsUserOnly = true, IsGreetingMessageAllow = true }, new Employee { EmployeeID = 87, FirstName = "Nestor", LastName = "Shyfruch", DepartmentID = 3, EID = "shne", IsUserOnly = true, IsGreetingMessageAllow = true }, new Employee { EmployeeID = 88, FirstName = "George", LastName = "Dao", DepartmentID = 4, EID = "dago", IsUserOnly = true, IsGreetingMessageAllow = true }, new Employee { EmployeeID = 89, FirstName = "Onyfriy", LastName = "Boo", DepartmentID = 5, EID = "boon", IsUserOnly = true, IsGreetingMessageAllow = true }, new Employee { EmployeeID = 90, FirstName = "Kristy", LastName = "Fenshyi", DepartmentID = 6, EID = "fekr", IsUserOnly = true, IsGreetingMessageAllow = true }, new Employee { EmployeeID = 91, FirstName = "Li", LastName = "Moon", DepartmentID = 7, EID = "moli", IsUserOnly = true, IsGreetingMessageAllow = true }, new Employee { EmployeeID = 92, FirstName = "Lily", LastName = "Anderson", DepartmentID = 9, EID = "lian", IsUserOnly = true, IsGreetingMessageAllow = true } }; using (var db = new AjourBTForTestContext()) { foreach (var item in usersToAdd) { db.Employees.Add(item); } db.SaveChanges(); } }