private static void InsertPeople() { using (var db = new AbsenceManagementContext()) { db.Database.Log = Console.WriteLine; var repo = new EFDisconnectedPersonRepository(db); foreach (var person in GetPeople()) { repo.Add(person); } } }
public void Can_Add() { // Arrange var sut = new EFDisconnectedPersonRepository( EFTestData.GetTransientAbsenceManagementContext() ); var user = PersonBuilder.CreatePerson("John", "Doe").Build(); // Act sut.Add(user); var actual = sut.GetAll().FirstOrDefault(p => p.FirstName.Equals("John")); // Assert Assert.Equal(1, sut.GetAll().Count()); Assert.NotNull(actual); Assert.Equal(user.FirstName, actual.FirstName); Assert.Equal(user.LastName, actual.LastName); }