コード例 #1
0
ファイル: SearchTests.cs プロジェクト: saasu/api-sdk-dotnet
        public void IndexedInventoryItemShouldMatchEntityData()
        {
            var searchProxy = new SearchProxy();

            var inventoryItem = InsertAndGetInventoryItem();

            var searchResults = searchProxy.Search(inventoryItem.Code, SearchScope.InventoryItems, 1, 10);
            Assert.IsNotNull(searchResults.DataObject);
            Assert.IsTrue(searchResults.DataObject.InventoryItems.Count > 0);

            var indexedInventoryItem = searchResults.DataObject.InventoryItems.First(x => ReplaceEm(x.Code) == inventoryItem.Code);
            Assert.IsNotNull(indexedInventoryItem);
            Assert.AreEqual(inventoryItem.BuyingPrice, indexedInventoryItem.BuyingPrice);
            Assert.AreEqual(inventoryItem.Description, ReplaceEm(indexedInventoryItem.Description));
            Assert.AreEqual(inventoryItem.Type, indexedInventoryItem.Type);
            Assert.AreEqual("Item", indexedInventoryItem.EntityType);
            Assert.AreEqual(inventoryItem.Id, indexedInventoryItem.Id);
            Assert.AreEqual(inventoryItem.SellingPrice, indexedInventoryItem.SellingPrice);
            Assert.AreEqual(inventoryItem.StockOnHand.HasValue ? inventoryItem.StockOnHand : 0M, indexedInventoryItem.StockOnHand);
            Assert.AreEqual(inventoryItem.PrimarySupplierItemCode, indexedInventoryItem.SupplierItemCode);
        }
コード例 #2
0
ファイル: SearchTests.cs プロジェクト: saasu/api-sdk-dotnet
        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);
        }
コード例 #3
0
ファイル: SearchTests.cs プロジェクト: saasu/api-sdk-dotnet
        public void IndexedTransactionShouldMatchEntityData()
        {
            var searchProxy = new SearchProxy();
            var invoice = new InvoiceProxy().GetInvoice(_invoiceHelper.InvoiceId1.Value).DataObject;
            Assert.IsNotNull(invoice.BillingContactId, "Contact not found");
            var contact = new ContactProxy().GetContact(invoice.BillingContactId.Value).DataObject;

            var searchResults = searchProxy.Search(_invoiceHelper.InvoiceId1Summary, SearchScope.Transactions, 1, 100);
            Assert.IsNotNull(searchResults.DataObject);
            Assert.IsTrue(searchResults.DataObject.Transactions.Count > 0);
            var indexedTransaction = searchResults.DataObject.Transactions.First(x => x.Id == invoice.TransactionId);

            Assert.AreEqual(invoice.DueDate, indexedTransaction.DueDate);
            Assert.AreEqual(invoice.BillingContactOrganisationName, indexedTransaction.Company);
            Assert.AreEqual(contact.EmailAddress, ReplaceEm(indexedTransaction.ContactEmail));
            Assert.AreEqual(invoice.InvoiceNumber, indexedTransaction.InvoiceNumber);
            Assert.AreEqual(invoice.PurchaseOrderNumber, indexedTransaction.PurchaseOrderNumber);
            Assert.AreEqual(invoice.NotesExternal, indexedTransaction.ExternalNotes);
            Assert.AreEqual(invoice.NotesInternal, indexedTransaction.Notes);
            Assert.AreEqual(invoice.TransactionType, indexedTransaction.Type);
        }
コード例 #4
0
ファイル: SearchTests.cs プロジェクト: saasu/api-sdk-dotnet
 public void ShouldReturnTransactionForScopedSearch()
 {
     var searchProxy = new SearchProxy();
     var results = searchProxy.Search("test", SearchScope.Transactions, 1, 25);
     Assert.IsNotNull(results, "No search results returned.");
     Assert.IsTrue(results.DataObject.Transactions.Count > 0, "No transactions returned.");
     Assert.IsTrue(results.DataObject.TotalTransactionsFound > 0, "transaction count is 0.");
     Assert.AreEqual(0, results.DataObject.TotalContactsFound, "Should not return contacts for search scoped to Contacts");
     Assert.AreEqual(0, results.DataObject.TotalInventoryItemsFound, "Should not return items for search scoped to Contacts");
 }
コード例 #5
0
ファイル: SearchTests.cs プロジェクト: saasu/api-sdk-dotnet
 public void ShouldReturnSalesOnlyWhenTransactionEntityTypeSpecified()
 {
     var searchProxy = new SearchProxy();
     var results = searchProxy.Search("test", SearchScope.Transactions, 1, 25, "transactions.sale");
     Assert.IsNotNull(results, "No search results returned.");
     Assert.IsNotNull(results.DataObject, "No search result object returned.");
     Assert.IsTrue(results.DataObject.Transactions.TrueForAll(x => x.Type == "S"));
 }
コード例 #6
0
ファイル: SearchTests.cs プロジェクト: saasu/api-sdk-dotnet
 public void ShouldReturnNotResults()
 {
     var searchProxy = new SearchProxy();
     var results = searchProxy.Search("qwerty", SearchScope.All, 1, 25);
     Assert.IsNotNull(results, "No search results returned.");
     Assert.IsNotNull(results.DataObject, "No search result object returned.");
     Assert.AreEqual(0, results.DataObject.InventoryItems.Count);
     Assert.AreEqual(0, results.DataObject.Contacts.Count);
     Assert.AreEqual(0, results.DataObject.InventoryItems.Count);
     Assert.AreEqual(0, results.DataObject.TotalInventoryItemsFound);
     Assert.AreEqual(0, results.DataObject.TotalContactsFound);
     Assert.AreEqual(0, results.DataObject.TotalTransactionsFound);
 }
コード例 #7
0
ファイル: SearchTests.cs プロジェクト: saasu/api-sdk-dotnet
 public void ShouldReturnInventoryItemsForScopedSearch()
 {
     var searchProxy = new SearchProxy();
     var results = searchProxy.Search("test", SearchScope.InventoryItems, 1, 25);
     Assert.IsNotNull(results, "No search results returned.");
     Assert.IsNotNull(results.DataObject, "No search result object returned.");
     Assert.IsTrue(results.DataObject.InventoryItems.Count > 0, "No inventory items returned.");
     Assert.IsTrue(results.DataObject.TotalInventoryItemsFound > 0, "Inventory item count is 0.");
     Assert.IsTrue(results.DataObject.TotalTransactionsFound == 0, "Should not return transactions for search scoped to Contacts");
     Assert.IsTrue(results.DataObject.TotalContactsFound == 0, "Should not return contacts for search scoped to Contacts");
 }