public void AddAddressToContact(Address address)
        {
            if (address == null)
            {
                throw new ArgumentNullException("address");
            }

            address.Contact = this;
            Addresses.Add(address);
        }
        public void DoubleInsert()
        {
            Address address = new Address();
            address.Address1 = "TEST1";
            address.Address2 = "N/A";
            address.Town = "TEST TOWN";
            address.County = "TEST COUNTY";
            address.Country = "UK";
            address.Postcode = "XXXXXXX";
            address.Active = true;
            address.CreatedOn = DateTime.Now;
            address.LastUpdatedOn = DateTime.Now;

            Phone phone = new Phone();
            phone.Number = "01273234122";
            phone.Type = "HOME";
            phone.CreatedOn = DateTime.Now;
            phone.LastUpdatedOn = DateTime.Now;

            PersonalContact contact = new PersonalContact();
            contact.Firstname = "Amin";
            contact.Surname = "Mohammed-Coleman";
            contact.Email = "*****@*****.**";
            contact.DateOfBirth = DateTime.Now;

            // contact.NotifyBirthDay( false );
            contact.CreatedOn = DateTime.Now;
            contact.LastUpdatedOn = DateTime.Now;
            contact.Notes = "TEST";
            contact.AddAddressToContact(address);
            contact.AddPhoneToContact(phone);

            IFullTextSession s = Search.CreateFullTextSession(OpenSession());
            var tx = s.BeginTransaction();
            s.Save(contact);
            tx.Commit();

            s.Close();

            s = Search.CreateFullTextSession(OpenSession());
            tx = s.BeginTransaction();
            Term term = new Term("county", "county");
            TermQuery termQuery = new TermQuery(term);
            IList results = s.CreateFullTextQuery(termQuery).List();
            Assert.AreEqual(1, results.Count);
            s.Flush();
            s.Clear();

            s.Delete("from System.Object");
            tx.Commit();

            s.Close();
        }
        public void RemoveAddressFromContact(Address address)
        {
            if (address == null)
            {
                throw new ArgumentNullException("address");
            }

            if (Addresses.Contains(address))
            {
                Addresses.Remove(address);
            }
        }