Пример #1
0
        public void IndexedContactShouldMatchEntityData()
        {
            var searchProxy   = new SearchProxy();
            var contactHelper = new ContactHelper();

            var contactResponse = contactHelper.AddContact();

            Thread.Sleep(2000);
            var contact = new ContactProxy().GetContact(contactResponse.InsertedContactId).DataObject;

            var searchResults = searchProxy.Search(contact.EmailAddress, SearchScope.Contacts, 1, 10);

            Assert.IsNotNull(searchResults.DataObject);
            Assert.IsTrue(searchResults.DataObject.Contacts.Count > 0);

            var indexedContact = searchResults.DataObject.Contacts.First(x => ReplaceEm(x.ContactEmail) == contact.EmailAddress);

            Assert.IsNotNull(indexedContact);
            Assert.AreEqual(contact.GivenName + " " + contact.FamilyName, ReplaceEm(indexedContact.Name));
            Assert.AreEqual(contact.MobilePhone, indexedContact.MobilePhone);
            Assert.AreEqual(contact.PrimaryPhone, indexedContact.MainPhone);
            Assert.AreEqual(contact.Id, indexedContact.Id);
            Assert.AreEqual("Contact", indexedContact.EntityType);
            Assert.AreEqual(contact.CompanyId ?? 0, indexedContact.CompanyId);
            Assert.AreEqual(contact.TwitterId, indexedContact.TwitterId);
        }
Пример #2
0
        public void ShouldBeAbleToPutToApiWithXml()
        {
            var contactHelper = new ContactHelper(false);
            var contact       = contactHelper.GetMinimalContact();

            contact.GivenName    = "SerializationTests";
            contact.FamilyName   = "PutToApiWithXml";
            contact.EmailAddress = "*****@*****.**";

            var proxy = new ContactProxy {
                ContentType = RequestContentType.ApplicationXml
            };
            var insertResponse = proxy.InsertContact(contact);

            Assert.True(insertResponse.DataObject.InsertedContactId > 0);

            var insertedContact = proxy.GetContact(insertResponse.DataObject.InsertedContactId);

            Assert.True(insertedContact.IsSuccessfull && insertedContact.DataObject != null);

            insertedContact.DataObject.GivenName = "NewNameWithXml";

            var updateResult = proxy.UpdateContact(insertedContact.DataObject, insertedContact.DataObject.Id.GetValueOrDefault());

            Assert.True(updateResult.IsSuccessfull);

            var updatedContact = proxy.GetContact(updateResult.DataObject.UpdatedContactId);

            Assert.True(updatedContact.IsSuccessfull);
            Assert.Equal("NewNameWithXml", updatedContact.DataObject.GivenName);
        }
Пример #3
0
        private void CreateTestContacts()
        {
            var contactHelper = new ContactHelper(false);

            _BillingContactId  = contactHelper.GetOrCreateContact("TestAPIInvoice", "BillingContact", "*****@*****.**");
            _ShippingContactId = contactHelper.GetOrCreateContact("TestAPIInvoice", "ShippingContact", "*****@*****.**");
        }
Пример #4
0
        private void CreateContacts()
        {
            var helper = new ContactHelper(false);

            //Create contacts.
            _DeletedContactId    = helper.AddContact().InsertedContactId;
            _NotDeletedContactId = helper.AddContact().InsertedContactId;

            //Delete only fist contact.
            new ContactProxy().DeleteContact(_DeletedContactId);
        }
Пример #5
0
        public void ShouldBeAbleToPostToApiWithJson()
        {
            var contactHelper = new ContactHelper(false);
            var contact       = contactHelper.GetMinimalContact();

            contact.GivenName    = "SerializationTests";
            contact.FamilyName   = "PostToApiWithJson";
            contact.EmailAddress = "*****@*****.**";

            var proxy = new ContactProxy();

            proxy.ContentType = RequestContentType.ApplicationJson;
            var insertResponse = proxy.InsertContact(contact);

            Assert.True(insertResponse.DataObject.InsertedContactId > 0);
        }
Пример #6
0
        public void IndexedContactShouldMatchEntityData()
        {
            var searchProxy = new SearchProxy();
            var contactHelper = new ContactHelper();

            var contactResponse = contactHelper.AddContact();
            Thread.Sleep(2000);
            var contact = new ContactProxy().GetContact(contactResponse.InsertedContactId).DataObject;

            var searchResults = searchProxy.Search(contact.EmailAddress, SearchScope.Contacts, 1, 10);
            Assert.IsNotNull(searchResults.DataObject);
            Assert.IsTrue(searchResults.DataObject.Contacts.Count > 0);

            var indexedContact = searchResults.DataObject.Contacts.First(x => ReplaceEm(x.ContactEmail) == contact.EmailAddress);
            Assert.IsNotNull(indexedContact);
            Assert.AreEqual(contact.GivenName + " " + contact.FamilyName, ReplaceEm(indexedContact.Name));
            Assert.AreEqual(contact.MobilePhone, indexedContact.MobilePhone);
            Assert.AreEqual(contact.PrimaryPhone, indexedContact.MainPhone);
            Assert.AreEqual(contact.Id, indexedContact.Id);
            Assert.AreEqual("Contact", indexedContact.EntityType);
            Assert.AreEqual(contact.CompanyId ?? 0, indexedContact.CompanyId);
            Assert.AreEqual(contact.TwitterId, indexedContact.TwitterId);
        }
Пример #7
0
 public ContactAggregateTests()
 {
     _contactHelper = new ContactHelper();
 }
Пример #8
0
 public ContactAggregateTests()
 {
     _contactHelper = new ContactHelper();
 }