コード例 #1
0
		public static ContactEntity CreateContact()
		{
			ContactRepository repository = new ContactRepository(ConfigSettings.MySqlDatabaseConnectionName);
			ContactEntity entity = ContactData.GetItemForInsert();
			//repository.ClearCollection();

			entity = repository.Create(entity);

			return entity;
		}
コード例 #2
0
		public void Init()
		{
			try
			{
				_repository = new ContactRepository(ConfigSettings.MySqlDatabaseConnectionName);
				_repository.ClearCollection();
			}
			catch (Exception ex)
			{
				Console.WriteLine(ex);
			}
		}
コード例 #3
0
		public void ShouldThrowArgumentNullExceptionOnConstructor()
		{
			// Act
			try
			{
				ContactRepository repository = new ContactRepository(null);
				Assert.Fail("This should not happen");
			}
			catch (Exception ex)
			{
				// Arrange
				Assert.IsInstanceOf<ArgumentNullException>(ex);
			}
		}
コード例 #4
0
		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();
		}
コード例 #5
0
		private static void CreateContacts()
		{
			ContactRepository repository = new ContactRepository(ConfigSettings.MySqlDatabaseConnectionName);

			ContactEntity entity = new ContactEntity()
			{
				ContactTypeId = _contactTypeEntities[0].Id,
				EntityId = _entityEntities[0].Id,
				Value = "*****@*****.**",
				Preferred = true,
				DeletedDate = DateTime.MinValue
			};
			ContactEntity mEntity = new ContactEntity()
			{
				ContactTypeId = _contactTypeEntities[1].Id,
				EntityId = _entityEntities[1].Id,
				Value = "0768827423",
				Preferred = true,
				DeletedDate = DateTime.MinValue
			};

			entity = repository.Create(entity);
			mEntity = repository.Create(mEntity);

			_contactEntities.Add(entity);
			_contactEntities.Add(mEntity);
		}
コード例 #6
0
		public static void ClearContact()
		{
			ContactRepository repository = new ContactRepository(ConfigSettings.MySqlDatabaseConnectionName);
			repository.ClearCollection();
		}