示例#1
0
        private void GetPrimarySupplierContact()
        {
            var contact = new Contact()
            {
                GivenName = "Peter",
                FamilyName = "Baker",
                EmailAddress = "*****@*****.**",
                HomePhone = "0252113414"
            };

            var proxy = new ContactProxy();
            var response = proxy.InsertContact(contact);
            _primarySupplierId = response.DataObject.InsertedContactId;
        }
        public void InsertContactWithoutAddressDoesNotFail()
        {
            var contact = new Contact()
            {
                GivenName = "John",
                FamilyName = "Cook",
                EmailAddress = "*****@*****.**",
                HomePhone = "0211114444"
            };

            var proxy = new ContactProxy();
            var response = proxy.InsertContact(contact);

            Assert.IsTrue(response.IsSuccessfull);
            Assert.IsTrue(response.DataObject.InsertedContactId > 0);

            System.Threading.Thread.Sleep(1000); // Tags are saved through messagequeue, give time to be processed
            var insertedContact = proxy.GetContact(response.DataObject.InsertedContactId);
            Assert.IsNotNull(insertedContact.DataObject);
            Assert.AreEqual(contact.EmailAddress, insertedContact.DataObject.EmailAddress);
        }
 public ProxyResponse<UpdateContactResult> UpdateContact(Contact contact, int contactId)
 {
     OperationMethod = HttpMethod.Put;
     var uri = base.GetRequestUri(contactId.ToString());
     return base.GetResponse<Contact, UpdateContactResult>(uri, contact);
 }
 public ProxyResponse<InsertContactResult> InsertContact(Contact contact)
 {
     OperationMethod = HttpMethod.Post;
     var uri = base.GetRequestUri(null);
     return base.GetResponse<Contact, InsertContactResult>(uri, contact);
 }
 private Contact GetContact()
 {
     var contact = new Contact()
     {
         FamilyName = "Stewart".MakeUnique(),
         IsActive = true,
         GivenName = "Jill".MakeUnique(),
         EmailAddress = "me@test".MakeUnique() + ".com",
         ContactId = "3333",
         Fax = "0211112222",
         IsContractor = false,
         IsCustomer = false,
         IsPartner = false,
         MiddleInitials = "MM",
         IsSupplier = false,
         MobilePhone = "0411112222",
         PositionTitle = "Manager",
         PrimaryPhone = "0222223333",
         HomePhone = "0245674567",
         Salutation = "Mrs."
     };
     return contact;
 }
 private Contact GetCompleteContact()
 {
     var contact = new Contact()
     {
         FamilyName = "Stewart".MakeUnique(),
         IsActive = true,
         GivenName = "Jill".MakeUnique(),
         EmailAddress = "me@test".MakeUnique() + ".com",
         ContactId = "3333",
         Fax = "0211112222",
         IsContractor = false,
         IsCustomer = false,
         IsPartner = false,
         MiddleInitials = "MM",
         IsSupplier = false,
         MobilePhone = "0411112222",
         PositionTitle = "Manager",
         PrimaryPhone = "0222223333",
         Salutation = "Mrs.",
         AutoSendStatement = true,
         BpayDetails = new BpayDetails { BillerCode = "wer", CRN = "crn1" },
         ChequeDetails = new ChequeDetails { AcceptCheque = true, ChequePayableTo = "someone" },
         CustomField1 = "Custom1",
         CustomField2 = "Custom2",
         DefaultPurchaseDiscount = 10,
         DefaultSaleDiscount = 12,
         DirectDepositDetails = new DirectDepositDetails { AcceptDirectDeposit = true, AccountBSB = "012210", AccountName = "Account name", AccountNumber = "123345" },
         HomePhone = "0245674567",
         OtherAddress = new Address { State = "NSW", Street = "Second street", Postcode = "2100", Country = "Australia", City = "Sydney" },
         PostalAddress = new Address { State = "NSW", Street = "First street", City = "Sydney", Postcode = "2000", Country = "Australia" },
         OtherPhone = "0221212121",
         PurchaseTradingTerms = new TradingTerms { TradingTermsInterval = 1, TradingTermsIntervalType = 2, TradingTermsType = 1 },
         SaleTradingTerms = new TradingTerms { TradingTermsInterval = 2, TradingTermsIntervalType = 2, TradingTermsType = 1 },
         WebsiteUrl = "http://test.com",
         LinkedInProfile = "linked",
         SkypeId = "skype",
         TwitterId = "@twit"
     };
     return contact;
 }
 private static void AssertContactManager(ContactManager expectedContactManager,
     Contact actualContact)
 {
     Assert.AreEqual(expectedContactManager.FamilyName, actualContact.FamilyName,
         "FamilyName not updated for contact manager");
     Assert.AreEqual(expectedContactManager.GivenName, actualContact.GivenName,
         "GivenName not updated for contact manager");
     Assert.AreEqual(expectedContactManager.MiddleInitials,
         actualContact.MiddleInitials, "MiddleInitials not updated for contact manager");
     Assert.AreEqual(expectedContactManager.PositionTitle,
         actualContact.PositionTitle, "PositionTitle not updated for contact manager");
     Assert.AreEqual(expectedContactManager.Salutation, actualContact.Salutation,
         "Salutation not updated for contact manager");
 }