Skip to content

Commit

Permalink
Minor refactoring and typos. (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
OGKevin committed Jul 20, 2018
1 parent 1caac36 commit 0ed3dc4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 23 deletions.
24 changes: 24 additions & 0 deletions BunqSdk.Tests/BunqSdkTestBase.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 System.Net.Http;
using Bunq.Sdk.Context;
using Bunq.Sdk.Exception;
Expand All @@ -15,6 +16,11 @@ namespace Bunq.Sdk.Tests
/// </summary>
public class BunqSdkTestBase
{
/// <summary>
/// Error constants.
/// </summary>
private const string ErrorCouldNotDetermineUserAlias = "Could not determine user alias.";

/// <summary>
/// Name of the context configuration file.
/// </summary>
Expand Down Expand Up @@ -145,5 +151,23 @@ protected static Pointer GetPointerBravo()
{
return new Pointer(PointerTypeEmail, EmailBravo);
}

protected static Pointer GetAlias()
{
var userContex = BunqContext.UserContext;

if (userContex.IsOnlyUserPersonSet())
{
return userContex.UserPerson.Alias.First();
}
else if (userContex.IsOnlyUserCompanySet())
{
return userContex.UserCompany.Alias.First();
}
else
{
throw new BunqException(ErrorCouldNotDetermineUserAlias);
}
}
}
}
22 changes: 2 additions & 20 deletions BunqSdk.Tests/Model/Generated/Endpoint/CardDebitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Bunq.Sdk.Tests.Model.Generated.Endpoint
public class CardDebitTest : BunqSdkTestBase
{
/// <summary>
/// Card constatns.
/// Card constants.
/// </summary>
private const string CardPinAssignmentTypePrimary = "PRIMARY";
private const string PinCode = "4045";
Expand All @@ -27,7 +27,7 @@ public class CardDebitTest : BunqSdkTestBase
private const string CardTypeMaestro = "MAESTRO";

/// <summary>
/// Numbder constants.
/// Number constants.
/// </summary>
private const int BaseDecimal = 10;
private const int NumberOne = 1;
Expand Down Expand Up @@ -77,23 +77,5 @@ private static string GenerateRandomSecondLine()
(int) Math.Pow(BaseDecimal, CardSecondLineLengthMaximum + NumberOne) - NumberOne
).ToString();
}

private static Pointer GetAlias()
{
var userContex = BunqContext.UserContext;

if (userContex.IsOnlyUserPersonSet())
{
return userContex.UserPerson.Alias.First();
}
else if (userContex.IsOnlyUserCompanySet())
{
return userContex.UserCompany.Alias.First();
}
else
{
throw new BunqException("");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class MonetaryAccountBankTest : BunqSdkTestBase
/// Config values
/// </summary>
private const string Status = "CANCELLED";
private const string SubsStatus = "REDEMPTION_VOLUNTARY";
private const string SubStatus = "REDEMPTION_VOLUNTARY";
private const string Reason = "OTHER";
private const string ReasonDescription = "Because this is a test";

Expand All @@ -34,7 +34,7 @@ public void TestCreationNewMonetaryAccount()

private static void DeleteMonetaryAccount(int idToClose)
{
MonetaryAccountBank.Update(idToClose, status: Status, subStatus: SubsStatus, reason: Reason,
MonetaryAccountBank.Update(idToClose, status: Status, subStatus: SubStatus, reason: Reason,
reasonDescription: ReasonDescription);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Bunq.Sdk.Tests.Model.Generated.Endpoint
public class RequestInquiryTest : BunqSdkTestBase
{
/// <summary>
/// The status for accepting a requst.
/// The status for accepting a request.
/// </summary>
private const string Status = "ACCEPTED";

Expand Down

0 comments on commit 0ed3dc4

Please sign in to comment.