public void ShouldCreateContacts() { // Arrange ContactTypeRepository repository = new ContactTypeRepository(ConfigSettings.MySqlDatabaseConnectionName); List<ContactTypeEntity> entities = ContactTypeData.GetItemsForInsert(); repository.ClearCollection(); // Act entities = repository.Create(entities); // Assert Assert.IsNotNull(entities); Assert.AreEqual(2, entities.Count); }
public void ShouldCreateContact() { // Arrange ContactTypeRepository repository = new ContactTypeRepository(ConfigSettings.MySqlDatabaseConnectionName); ContactTypeEntity entity = ContactTypeData.GetItemForInsert(); repository.ClearCollection(); // Act entity = repository.Create(entity); // Assert Assert.IsNotNull(entity); Assert.AreNotEqual(0, entity.Id); }
public void ShouldReadContactWithId() { // Arrange ContactTypeRepository repository = new ContactTypeRepository(ConfigSettings.MySqlDatabaseConnectionName); ContactTypeEntity entity = ContactTypeData.GetItemForInsert(); repository.ClearCollection(); // Act entity = repository.Create(entity); // Act var actual = repository.Read(entity.Id); // Assert Assert.AreEqual(entity.Description, actual.Description); }
public void ShouldUpdateContact() { // Arrange ContactTypeRepository repository = new ContactTypeRepository(ConfigSettings.MySqlDatabaseConnectionName); ContactTypeEntity entity = ContactTypeData.GetItemForInsert(); repository.ClearCollection(); entity = repository.Create(entity); entity.Description = "Employee"; // Act ContactTypeEntity actual = repository.Update(entity); // Assert Assert.AreEqual(entity.Description, actual.Description); }
private static void CreateContactTypes() { ContactTypeRepository repository = new ContactTypeRepository(ConfigSettings.MySqlDatabaseConnectionName); ContactTypeEntity entity = new ContactTypeEntity() { Description = "Email", DeletedDate = DateTime.MinValue }; ContactTypeEntity mEntity = new ContactTypeEntity() { Description = "Mobile", DeletedDate = DateTime.MinValue }; ContactTypeEntity entity3 = new ContactTypeEntity() { Description = "Work Phone", DeletedDate = DateTime.MinValue }; ContactTypeEntity entity4 = new ContactTypeEntity() { Description = "Home Phone", DeletedDate = DateTime.MinValue }; entity = repository.Create(entity); mEntity = repository.Create(mEntity); entity3 = repository.Create(entity3); entity4 = repository.Create(entity4); _contactTypeEntities.Add(entity); _contactTypeEntities.Add(mEntity); _contactTypeEntities.Add(entity3); _contactTypeEntities.Add(entity4); }
public static ContactTypeEntity CreateContactType() { ContactTypeRepository repository = new ContactTypeRepository(ConfigSettings.MySqlDatabaseConnectionName); ContactTypeEntity entity = ContactTypeData.GetItemForInsert(); //repository.ClearCollection(); entity = repository.Create(entity); return entity; }