public static void MockInvoiceListResponse ( List <InvoiceInfo> infoList, int currentPage = 1, int?nextPage = null, int?prevPage = null, int totalPages = 1, int?totalCount = null ) { if (totalCount == null) { totalCount = infoList.Count; } var invoiceDictList = infoList .Select(info => MoyasarService.Serializer.Deserialize <Dictionary <string, object> >( FixturesHelper.GetInvoiceJson(info) )).ToList(); var listJson = MoyasarService.Serializer.Serialize(new { invoices = invoiceDictList, meta = new Dictionary <string, object> { { "current_page", currentPage }, { "next_page", nextPage }, { "prev_page", prevPage }, { "total_pages", totalPages }, { "total_count", totalCount } } }); HttpMockHelper.MockHttpResponse(HttpStatusCode.OK, listJson); }
public static void MockInvoiceResponse(InvoiceInfo info, List <PaymentInfo> paymentsInfo = null, string id = null, string status = "initiated") { var listJson = "null"; if (paymentsInfo != null) { var paymentDictList = paymentsInfo .Select(i => MoyasarService.Serializer.Deserialize <Dictionary <string, object> >( FixturesHelper.GetPaymentJson(i) )).ToList(); listJson = MoyasarService.Serializer.Serialize(paymentDictList); } var invoiceJson = FixturesHelper.GetInvoiceJson(info, listJson, id, status); HttpMockHelper.MockHttpResponse(HttpStatusCode.OK, invoiceJson); }