Skip to content

Commit

Permalink
(#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
OGKevin committed Jul 10, 2018
1 parent efe98f7 commit 563d47e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 15 deletions.
49 changes: 36 additions & 13 deletions BunqSdk.Tests/BunqSdkTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public class BunqSdkTestBase
protected const string PaymentCurrency = "EUR";
protected const string PaymentDescription = "C# test Payment";

/// <summary>
/// Constants for monetary account.
/// </summary>
protected const string MonetaryAccountDescription = "Test C# monetary account";

/// <summary>
/// Image constants.
/// </summary>
Expand All @@ -35,10 +40,28 @@ public class BunqSdkTestBase
protected const string AttachmentDescription = "C# sdk image test.";
protected const string AttachmentPathIn = "/bunq_App_Icon_Square@4x.png";

protected const string MonetaryAccountDescription = "Test C# monetary account";

protected const int IndexFirst = 0;
/// <summary>
/// Device registration constants.
/// </summary>
private const string DeviceDescription = "Csharp test device";

/// <summary>
/// Pointer type constants.
/// </summary>
private const string PointerTypeEmail = "EMAIL";

/// <summary>
/// Email constants.
/// </summary>
private const string EmailBravo = "bravo@bunq.com";
private const string EmailSuggarDaddy = "sugardaddy@bunq.com";

/// <summary>
/// Spending money constants.
/// </summary>
private const string SpendingMoneyAmount = "50.00";
private const string SpendingMoneyRequestDescription = "sdk c# test, thanks daddy.";

protected static MonetaryAccountBank SecondMonetaryAccountBank;

/// <summary>
Expand Down Expand Up @@ -66,7 +89,7 @@ protected static ApiContext SetUpApiContext()
else
{
var sandboxUser = GenerateNewSandboxUser();
apiContext = ApiContext.Create(ApiEnvironmentType.SANDBOX, sandboxUser.ApiKey, "Csharp test device");
apiContext = ApiContext.Create(ApiEnvironmentType.SANDBOX, sandboxUser.ApiKey, DeviceDescription);
}

BunqContext.LoadApiContext(apiContext);
Expand Down Expand Up @@ -96,32 +119,32 @@ private static SandboxUser GenerateNewSandboxUser()

private static MonetaryAccountBank SetUpSecondMonetaryAccount()
{
var createdMonetaryAccountId = MonetaryAccountBank.Create("EUR", MonetaryAccountDescription);
var createdMonetaryAccountId = MonetaryAccountBank.Create(PaymentCurrency, MonetaryAccountDescription);

return MonetaryAccountBank.Get(createdMonetaryAccountId.Value).Value;
}

private static void RequestSpendingMoney()
{
RequestInquiry.Create(
new Amount("50.00", "EUR"),
new Pointer("EMAIL", "sugardaddy@bunq.com"),
"sdk c# test, thanks daddy.",
new Amount(SpendingMoneyAmount, PaymentCurrency),
new Pointer(PointerTypeEmail, EmailSuggarDaddy),
SpendingMoneyRequestDescription,
false
);

RequestInquiry.Create(
new Amount("50.00", "EUR"),
new Pointer("EMAIL", "sugardaddy@bunq.com"),
"sdk c# test, thanks daddy.",
new Amount(SpendingMoneyAmount, PaymentCurrency),
new Pointer(PointerTypeEmail, EmailSuggarDaddy),
SpendingMoneyRequestDescription,
false,
SecondMonetaryAccountBank.Id
);
}

protected Pointer GetPointerBravo()
protected static Pointer GetPointerBravo()
{
return new Pointer("EMAIL", "bravo@bunq.com");
return new Pointer(PointerTypeEmail, EmailBravo);
}
}
}
3 changes: 2 additions & 1 deletion BunqSdk.Tests/Model/Generated/Endpoint/AvatarTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Bunq.Sdk.Context;
using Bunq.Sdk.Http;
using Bunq.Sdk.Model.Generated.Endpoint;
Expand Down Expand Up @@ -34,7 +35,7 @@ public void TestCreateAvatarAndRetrieval()
var avatarUuid = Avatar.Create(attachmentUuid).Value;

var attachmentUuidFromAvatar = Avatar.Get(avatarUuid).Value
.Image[IndexFirst].AttachmentPublicUuid;
.Image.First().AttachmentPublicUuid;
var revievedFileContentByte = AttachmentPublicContent.List(attachmentUuidFromAvatar).Value;

Assert.Equal(attachmentUuid, attachmentUuidFromAvatar);
Expand Down
2 changes: 1 addition & 1 deletion BunqSdk.Tests/Model/Generated/Endpoint/CardDebitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void TestOrderNewMaestroCard()

private static string GetAnAllowedName()
{
return CardName.List().Value[IndexFirst].PossibleCardNameArray[IndexFirst];
return CardName.List().Value.First().PossibleCardNameArray.First();
}

private static string GenerateRandomSecondLine()
Expand Down

0 comments on commit 563d47e

Please sign in to comment.