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); }
private static void ClearAll() { PersonRepository repository1 = new PersonRepository(ConfigSettings.MySqlDatabaseConnectionName); ContactRepository repository2 = new ContactRepository(ConfigSettings.MySqlDatabaseConnectionName); EntityRepository repository3 = new EntityRepository(ConfigSettings.MySqlDatabaseConnectionName); OccupationNameRepository repository4 = new OccupationNameRepository(ConfigSettings.MySqlDatabaseConnectionName); EntityTypeRepository repository5 = new EntityTypeRepository(ConfigSettings.MySqlDatabaseConnectionName); ContactTypeRepository repository6 = new ContactTypeRepository(ConfigSettings.MySqlDatabaseConnectionName); TitleRepository repository7 = new TitleRepository(ConfigSettings.MySqlDatabaseConnectionName); AddressTypeRepository repository8 = new AddressTypeRepository(ConfigSettings.MySqlDatabaseConnectionName); AddressRepository repository9 = new AddressRepository(ConfigSettings.MySqlDatabaseConnectionName); GenderTypeRepository repository10 = new GenderTypeRepository(ConfigSettings.MySqlDatabaseConnectionName); repository9.ClearCollection(); repository1.ClearCollection(); repository2.ClearCollection(); repository3.ClearCollection(); repository4.ClearCollection(); repository5.ClearCollection(); repository6.ClearCollection(); repository7.ClearCollection(); repository8.ClearCollection(); repository10.ClearCollection(); }
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); }
public static void ClearContactType() { ContactTypeRepository repository = new ContactTypeRepository(ConfigSettings.MySqlDatabaseConnectionName); repository.ClearCollection(); }