public async void GetTransaction() { using (var server = TestServer.Create(app => { app.Run(async context => { Assert.AreEqual("Bearer testAccessToken", context.Request.Headers["Authorization"]); // workaround for mono bug Assert.That(context.Request.Uri.PathAndQuery, Is.EqualTo("/transactions/1")); await context.Response.WriteAsync( @"{ 'transaction': { 'account_balance': 13013, 'amount': -510, 'created': '2015-08-22T12:20:18Z', 'currency': 'GBP', 'description': 'THE DE BEAUVOIR DELI C LONDON GBR', 'id': 'tx_00008zIcpb1TB4yeIFXMzx', 'merchant': 'merch_00008zIcpbAKe8shBxXUtl', 'metadata': {}, 'notes': 'Salmon sandwich 🍞', 'is_load': false, 'settled': true } }" ); }); })) { using (var client = new MondoClient(server.HttpClient, "testAccessToken")) { var transaction = await client.GetTransactionAsync("1"); Assert.AreEqual(13013, transaction.AccountBalance); Assert.AreEqual(-510, transaction.Amount); Assert.AreEqual(new DateTime(2015, 8, 22, 12, 20, 18, DateTimeKind.Utc), transaction.Created); Assert.AreEqual("GBP", transaction.Currency); Assert.AreEqual("THE DE BEAUVOIR DELI C LONDON GBR", transaction.Description); Assert.AreEqual("tx_00008zIcpb1TB4yeIFXMzx", transaction.Id); Assert.AreEqual(new Dictionary <string, string>(), transaction.Metadata); Assert.AreEqual("Salmon sandwich 🍞", transaction.Notes); Assert.IsFalse(transaction.IsLoad); Assert.AreEqual("merch_00008zIcpbAKe8shBxXUtl", transaction.Merchant.Id); } } }
public async void GetTransactionExpanded() { using (var server = TestServer.Create(app => { app.Run(async context => { Assert.AreEqual("Bearer testAccessToken", context.Request.Headers["Authorization"]); // workaround for mono bug Assert.That(context.Request.Uri.PathAndQuery, Is.EqualTo("/transactions/1?expand[]=merchant").Or.EqualTo("/transactions/1?expand%5B%5D=merchant")); await context.Response.WriteAsync( @"{ 'transaction': { 'account_balance': 13013, 'amount': -510, 'created': '2015-08-22T12:20:18Z', 'currency': 'GBP', 'description': 'THE DE BEAUVOIR DELI C LONDON GBR', 'id': 'tx_00008zIcpb1TB4yeIFXMzx', 'merchant': { 'address': { 'address': '98 Southgate Road', 'city': 'London', 'country': 'GB', 'latitude': 51.54151, 'longitude': -0.08482400000002599, 'postcode': 'N1 3JD', 'region': 'Greater London' }, 'created': '2015-08-22T12:20:18Z', 'group_id': 'grp_00008zIcpbBOaAr7TTP3sv', 'id': 'merch_00008zIcpbAKe8shBxXUtl', 'logo': 'https://pbs.twimg.com/profile_images/527043602623389696/68_SgUWJ.jpeg', 'emoji': '🍞', 'name': 'The De Beauvoir Deli Co.', 'category': 'eating_out' }, 'metadata': {}, 'notes': 'Salmon sandwich 🍞', 'is_load': false, 'settled': true } }" ); }); })) { using (var client = new MondoClient(server.HttpClient, "testAccessToken")) { var transaction = await client.GetTransactionAsync("1", "merchant"); Assert.AreEqual(13013, transaction.AccountBalance); Assert.AreEqual(-510, transaction.Amount); Assert.AreEqual(new DateTime(2015, 8, 22, 12, 20, 18, DateTimeKind.Utc), transaction.Created); Assert.AreEqual("GBP", transaction.Currency); Assert.AreEqual("THE DE BEAUVOIR DELI C LONDON GBR", transaction.Description); Assert.AreEqual("tx_00008zIcpb1TB4yeIFXMzx", transaction.Id); Assert.AreEqual(new Dictionary<string, string>(), transaction.Metadata); Assert.AreEqual("Salmon sandwich 🍞", transaction.Notes); Assert.IsFalse(transaction.IsLoad); Assert.AreEqual("98 Southgate Road", transaction.Merchant.Address.Address); Assert.AreEqual("London", transaction.Merchant.Address.City); Assert.AreEqual(51.54151, transaction.Merchant.Address.Latitude); Assert.AreEqual(-0.08482400000002599, transaction.Merchant.Address.Longitude); Assert.AreEqual("N1 3JD", transaction.Merchant.Address.Postcode); Assert.AreEqual("Greater London", transaction.Merchant.Address.Region); Assert.AreEqual(new DateTime(2015, 8, 22, 12, 20, 18, DateTimeKind.Utc), transaction.Merchant.Created); Assert.AreEqual("grp_00008zIcpbBOaAr7TTP3sv", transaction.Merchant.GroupId); Assert.AreEqual("merch_00008zIcpbAKe8shBxXUtl", transaction.Merchant.Id); Assert.AreEqual("https://pbs.twimg.com/profile_images/527043602623389696/68_SgUWJ.jpeg", transaction.Merchant.Logo); Assert.AreEqual("🍞", transaction.Merchant.Emoji); Assert.AreEqual("The De Beauvoir Deli Co.", transaction.Merchant.Name); Assert.AreEqual("eating_out", transaction.Merchant.Category); } } }
public async void GetTransaction() { using (var server = TestServer.Create(app => { app.Run(async context => { Assert.AreEqual("Bearer testAccessToken", context.Request.Headers["Authorization"]); // workaround for mono bug Assert.That(context.Request.Uri.PathAndQuery, Is.EqualTo("/transactions/1")); await context.Response.WriteAsync( @"{ 'transaction': { 'account_balance': 13013, 'amount': -510, 'created': '2015-08-22T12:20:18Z', 'currency': 'GBP', 'description': 'THE DE BEAUVOIR DELI C LONDON GBR', 'id': 'tx_00008zIcpb1TB4yeIFXMzx', 'merchant': 'merch_00008zIcpbAKe8shBxXUtl', 'metadata': {}, 'notes': 'Salmon sandwich 🍞', 'is_load': false, 'settled': true } }" ); }); })) { using (var client = new MondoClient(server.HttpClient, "testAccessToken")) { var transaction = await client.GetTransactionAsync("1"); Assert.AreEqual(13013, transaction.AccountBalance); Assert.AreEqual(-510, transaction.Amount); Assert.AreEqual(new DateTime(2015, 8, 22, 12, 20, 18, DateTimeKind.Utc), transaction.Created); Assert.AreEqual("GBP", transaction.Currency); Assert.AreEqual("THE DE BEAUVOIR DELI C LONDON GBR", transaction.Description); Assert.AreEqual("tx_00008zIcpb1TB4yeIFXMzx", transaction.Id); Assert.AreEqual(new Dictionary<string, string>(), transaction.Metadata); Assert.AreEqual("Salmon sandwich 🍞", transaction.Notes); Assert.IsFalse(transaction.IsLoad); Assert.AreEqual("merch_00008zIcpbAKe8shBxXUtl", transaction.Merchant.Id); } } }
public async void GetTransactionExpanded() { using (var server = TestServer.Create(app => { app.Run(async context => { Assert.AreEqual("Bearer testAccessToken", context.Request.Headers["Authorization"]); // workaround for mono bug Assert.That(context.Request.Uri.PathAndQuery, Is.EqualTo("/transactions/1?expand[]=merchant").Or.EqualTo("/transactions/1?expand%5B%5D=merchant")); await context.Response.WriteAsync( @"{ 'transaction': { 'account_balance': 13013, 'amount': -510, 'created': '2015-08-22T12:20:18Z', 'currency': 'GBP', 'description': 'THE DE BEAUVOIR DELI C LONDON GBR', 'id': 'tx_00008zIcpb1TB4yeIFXMzx', 'merchant': { 'address': { 'address': '98 Southgate Road', 'city': 'London', 'country': 'GB', 'latitude': 51.54151, 'longitude': -0.08482400000002599, 'postcode': 'N1 3JD', 'region': 'Greater London' }, 'created': '2015-08-22T12:20:18Z', 'group_id': 'grp_00008zIcpbBOaAr7TTP3sv', 'id': 'merch_00008zIcpbAKe8shBxXUtl', 'logo': 'https://pbs.twimg.com/profile_images/527043602623389696/68_SgUWJ.jpeg', 'emoji': '🍞', 'name': 'The De Beauvoir Deli Co.', 'category': 'eating_out' }, 'metadata': {}, 'notes': 'Salmon sandwich 🍞', 'is_load': false, 'settled': true } }" ); }); })) { using (var client = new MondoClient(server.HttpClient, "testAccessToken")) { var transaction = await client.GetTransactionAsync("1", "merchant"); Assert.AreEqual(13013, transaction.AccountBalance); Assert.AreEqual(-510, transaction.Amount); Assert.AreEqual(new DateTime(2015, 8, 22, 12, 20, 18, DateTimeKind.Utc), transaction.Created); Assert.AreEqual("GBP", transaction.Currency); Assert.AreEqual("THE DE BEAUVOIR DELI C LONDON GBR", transaction.Description); Assert.AreEqual("tx_00008zIcpb1TB4yeIFXMzx", transaction.Id); Assert.AreEqual(new Dictionary <string, string>(), transaction.Metadata); Assert.AreEqual("Salmon sandwich 🍞", transaction.Notes); Assert.IsFalse(transaction.IsLoad); Assert.AreEqual("98 Southgate Road", transaction.Merchant.Address.Address); Assert.AreEqual("London", transaction.Merchant.Address.City); Assert.AreEqual(51.54151, transaction.Merchant.Address.Latitude); Assert.AreEqual(-0.08482400000002599, transaction.Merchant.Address.Longitude); Assert.AreEqual("N1 3JD", transaction.Merchant.Address.Postcode); Assert.AreEqual("Greater London", transaction.Merchant.Address.Region); Assert.AreEqual(new DateTime(2015, 8, 22, 12, 20, 18, DateTimeKind.Utc), transaction.Merchant.Created); Assert.AreEqual("grp_00008zIcpbBOaAr7TTP3sv", transaction.Merchant.GroupId); Assert.AreEqual("merch_00008zIcpbAKe8shBxXUtl", transaction.Merchant.Id); Assert.AreEqual("https://pbs.twimg.com/profile_images/527043602623389696/68_SgUWJ.jpeg", transaction.Merchant.Logo); Assert.AreEqual("🍞", transaction.Merchant.Emoji); Assert.AreEqual("The De Beauvoir Deli Co.", transaction.Merchant.Name); Assert.AreEqual("eating_out", transaction.Merchant.Category); } } }