public static ProxyResponse<InvoiceTransactionSummaryResponse> AssertInvoiceProxy(int? pageNumber = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? lastModifiedFromDate = null, DateTime? lastModifiedToDate = null, string invoiceNumber = null, string transactionType = null, int? paymentStatus = null, int? billingContactId = null, string invoiceStatus = null, string tags = null, string tagFilterType = null) { var response = new InvoicesProxy().GetInvoices(pageNumber, pageSize, fromDate, toDate, lastModifiedFromDate, lastModifiedToDate, invoiceNumber, transactionType, paymentStatus, billingContactId, invoiceStatus, tags, tagFilterType); Assert.IsNotNull(response, "Invoice response is null"); Assert.IsTrue(response.IsSuccessfull, "Invoice response not successfull"); Assert.IsNotNull(response.DataObject, "No data in invoice reposnse"); Assert.IsNotNull(response.DataObject.Invoices, "Empty invoices in response"); Assert.IsNotNull(response.DataObject._links, "Empty hypermedia links in response"); Assert.IsTrue(response.DataObject._links.Count > 0, "No hypermedia links in response"); Assert.IsTrue(response.DataObject.Invoices.Count > 0, "No invoices in response"); return response; }
public void ShouldGetOnlyFirstInvoiceForKnownFile() { var accessToken = TestHelper.SignInAndGetAccessToken(); var proxy = new InvoicesProxy(accessToken); var response = proxy.GetInvoices(); Assert.IsNotNull(response); Assert.IsTrue(response.IsSuccessfull); Assert.IsNotNull(response.DataObject); Assert.IsNotNull(response.DataObject.Invoices); Assert.IsTrue(response.DataObject.Invoices.Count > 0); }
public void ShouldBeAbleToAddSmallAttachmentUsingWsAccessKey() { var accessToken = TestHelper.SignInAndGetAccessToken(); var proxy = new InvoicesProxy(accessToken); var response = proxy.GetInvoices(); Assert.IsNotNull(response, "No response when getting invoices"); Assert.IsTrue(response.IsSuccessfull, "Getting invoices failed. STatus code: " + ((int)response.StatusCode).ToString()); Assert.IsTrue(response.DataObject.Invoices.Count > 0, "Number of invoices returned was not greater than 0"); _testInvoiceId = response.DataObject.Invoices[0].TransactionId; var attachment = CreateTestAttachment(); attachment.ItemIdAttachedTo = response.DataObject.Invoices[0].TransactionId.GetValueOrDefault(); var addResponse = new InvoiceProxy().AddAttachment(attachment); Assert.IsNotNull(addResponse, "No response when adding an attachment"); Assert.IsTrue(addResponse.IsSuccessfull, "Adding an attachment failed. STatus code: " + ((int)addResponse.StatusCode).ToString()); }
public void GetInvoicesSecondPage() { var proxy = new InvoicesProxy(); var response = proxy.GetInvoices(pageSize: 2); var idsFromPage1 = response.DataObject.Invoices.Select(i => i.TransactionId).ToList(); response = proxy.GetInvoices(pageNumber: 2); Assert.IsNotNull(response); Assert.IsTrue(response.IsSuccessfull); response.DataObject.Invoices.ForEach(i => Assert.IsFalse(idsFromPage1.Contains(i.TransactionId))); }
public void GetInvoicesPageSize() { var proxy = new InvoicesProxy(); var response = proxy.GetInvoices(pageNumber: 1, pageSize: 2); Assert.IsNotNull(response); Assert.IsTrue(response.IsSuccessfull); Assert.AreEqual(response.DataObject.Invoices.Count, 2); }
private static int? GetTestInvoiceId() { var response = new InvoicesProxy().GetInvoices(invoiceNumber: "TestInv1"); return response.DataObject.Invoices[0].TransactionId; }