Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constants following PascalCase convention #71

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d50b8b8
Rename constants following PascalCase convention. (bunq/sdk_csharp#58)
Dec 27, 2017
46214e0
Add curly braces around the nested statement in this if block. (bunq/…
Dec 27, 2017
8fd7136
Add information to test readme file on how to run tests in VS IDE. (b…
Dec 27, 2017
3fbb0e1
Update gitignore file. (bunq/sdk_csharp#58)
Dec 27, 2017
9b16490
Remove underscore prefix from private variables. (bunq/sdk_csharp#58)
Dec 27, 2017
17d446c
Rename constants following PascalCase convention. (bunq/sdk_csharp#58)
Dec 27, 2017
f405de3
Rename constants following group identifier and PascalCase convention…
Dec 28, 2017
4a90c80
Rename constants consistently. (bunq/sdk_csharp#58)
Dec 28, 2017
c43eb8c
Pink Floyds TDSOTM is 42 minutes lenght and expensive Java teas. (bun…
Dec 28, 2017
d53ea29
Rename constants consistently. (bunq/sdk_csharp#58)
Dec 28, 2017
d453229
Add information to test readme file on how to run tests in VS Code ID…
Dec 28, 2017
2da16bf
Remove redundant string array. (bunq/sdk_csharp#58)
Dec 28, 2017
d66b682
Reordered constants to their group. (bunq/sdk_csharp#58)
OGKevin Dec 28, 2017
2279dc8
Added missing constant pre and suffixes. (bunq/sdk_csharp#58)
OGKevin Dec 28, 2017
5f8e799
Reordered constant to their separate group. (bunq/sdk_csharp#58)
OGKevin Dec 28, 2017
c153018
Added missing summaries. (bunq/sdk_csharp#58)
OGKevin Dec 28, 2017
1aa819d
Moved property with accessors below the ones without. (bunq/sdk_cshar…
OGKevin Dec 28, 2017
9962a6d
Removed plural. (bunq/sdk_csharp#58)
OGKevin Dec 28, 2017
f10e0d3
Changed method scope to private. (bunq/sdk_csharp#58)
OGKevin Dec 28, 2017
50a81c3
Removed plural from example test configuration josn. (bunq/sdk_csharp…
OGKevin Dec 28, 2017
4240c77
Add information to test readme file on how to run tests in cmd line. …
Dec 29, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions BunqSdk.Tests/Model/Generated/Endpoint/MonetaryAccountBankTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ public class MonetaryAccountBankTest : BunqSdkTestBase
/// <summary>
/// Config values
/// </summary>
private const string Status = "CANCELLED";
private const string SubStatus = "REDEMPTION_VOLUNTARY";
private const string Reason = "OTHER";
private const string ReasonDescription = "Because this is a test";
private const string Currency = "EUR";
private const string Description = "Test C# monetary account";
private const string MonetaryAccountBankStatus = "CANCELLED";
private const string MonetaryAccountBankSubStatus = "REDEMPTION_VOLUNTARY";
private const string MonetaryAccountBankReason = "OTHER";
private const string MonetaryAccountBankReasonDescription = "Because this is a test";
private const string MonetaryAccountBankCurrency = "EUR";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets make this name future proof, MonetaryAccountBankCurrencyEur. If we start supporting other currencies then there will be less names to change 👍

private const string MonetaryAccountBankDescription = "Test C# monetary account";

private static readonly int UserId = Config.GetUserId();

Expand All @@ -36,8 +36,8 @@ public void TestCreationNewMonetaryAccount()
{
var requestMap = new Dictionary<string, object>
{
{MonetaryAccountBank.FIELD_CURRENCY, Currency},
{MonetaryAccountBank.FIELD_DESCRIPTION, Description}
{MonetaryAccountBank.FIELD_CURRENCY, MonetaryAccountBankCurrency},
{MonetaryAccountBank.FIELD_DESCRIPTION, MonetaryAccountBankDescription}
};
var monetaryAccountToCloseId = MonetaryAccountBank.Create(ApiContext, requestMap, UserId).Value;

Expand All @@ -48,10 +48,10 @@ private static void DeleteMonetaryAccount(int idToClose)
{
var requestMap = new Dictionary<string, object>
{
{MonetaryAccountBank.FIELD_STATUS, Status},
{MonetaryAccountBank.FIELD_SUB_STATUS, SubStatus},
{MonetaryAccountBank.FIELD_REASON, Reason},
{MonetaryAccountBank.FIELD_REASON_DESCRIPTION, ReasonDescription}
{MonetaryAccountBank.FIELD_STATUS, MonetaryAccountBankStatus},
{MonetaryAccountBank.FIELD_SUB_STATUS, MonetaryAccountBankSubStatus},
{MonetaryAccountBank.FIELD_REASON, MonetaryAccountBankReason},
{MonetaryAccountBank.FIELD_REASON_DESCRIPTION, MonetaryAccountBankReasonDescription}
};
MonetaryAccountBank.Update(ApiContext, requestMap, UserId, idToClose);
}
Expand Down
14 changes: 7 additions & 7 deletions BunqSdk.Tests/Model/Generated/Endpoint/PaymentChatTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public class PaymentChatTest : BunqSdkTestBase
/// <summary>
/// Config values.
/// </summary>
private const string Amount = "0.01";
private const string Currency = "EUR";
private const string Description = "Payment From C# Test";
private const string Text = "test msg send from C# test";
private const string PaymentChatAmountEur = "0.01";
private const string PaymentChatCurrency = "EUR";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please suffix the currency Eur

private const string PaymentChatDescription = "Payment From C# Test";
private const string PaymentChatText = "test msg send from C# test";

private static readonly int UserId = Config.GetUserId();
private static readonly int MonetaryAccountId = Config.GetMonetarytAccountId();
Expand All @@ -43,7 +43,7 @@ public void TestSendPaymentChat()

var chatMessageMap = new Dictionary<string, object>
{
{ChatMessageText.FIELD_TEXT, Text}
{ChatMessageText.FIELD_TEXT, PaymentChatText}
};
ChatMessageText.Create(ApiContext, chatMessageMap, UserId, chatId);
}
Expand All @@ -52,9 +52,9 @@ private static int CreatePaymentAndGetId()
{
var requestMap = new Dictionary<string, object>
{
{Payment.FIELD_AMOUNT, new Amount(Amount, Currency)},
{Payment.FIELD_AMOUNT, new Amount(PaymentChatAmountEur, PaymentChatCurrency)},
{Payment.FIELD_COUNTERPARTY_ALIAS, CounterPartyAlias},
{Payment.FIELD_DESCRIPTION, Description},
{Payment.FIELD_DESCRIPTION, PaymentChatDescription},
};

return Payment.Create(ApiContext, requestMap, UserId, MonetaryAccountId).Value;
Expand Down
14 changes: 7 additions & 7 deletions BunqSdk.Tests/Model/Generated/Endpoint/PaymentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public class PaymentTest : BunqSdkTestBase
/// <summary>
/// Config values.
/// </summary>
private const string Amount = "0.01";
private const string Currency = "EUR";
private const string Description = "C# test Payment";
private const string PaymentAmountEur = "0.01";
private const string PaymentCurrency = "EUR";
private const string PaymentDescription = "C# test Payment";

private static readonly int UserId = Config.GetUserId();
private static readonly int MonetaryAccountId = Config.GetMonetarytAccountId();
Expand All @@ -39,8 +39,8 @@ public void TestMakePaymentToOtherUser()
{
var requestMap = new Dictionary<string, object>
{
{Payment.FIELD_AMOUNT, new Amount(Amount, Currency)},
{Payment.FIELD_DESCRIPTION, Description},
{Payment.FIELD_AMOUNT, new Amount(PaymentAmountEur, PaymentCurrency)},
{Payment.FIELD_DESCRIPTION, PaymentDescription},
{Payment.FIELD_COUNTERPARTY_ALIAS, CounterPartyOther}
};

Expand All @@ -57,8 +57,8 @@ public void TestMakePaymentToOtherAccount()
{
var requestMap = new Dictionary<string, object>
{
{Payment.FIELD_AMOUNT, new Amount(Amount, Currency)},
{Payment.FIELD_DESCRIPTION, Description},
{Payment.FIELD_AMOUNT, new Amount(PaymentAmountEur, PaymentCurrency)},
{Payment.FIELD_DESCRIPTION, PaymentDescription},
{Payment.FIELD_COUNTERPARTY_ALIAS, CounterPartySelf}
};

Expand Down
25 changes: 12 additions & 13 deletions BunqSdk.Tests/Model/Generated/Endpoint/RequestInquiryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ public class RequestInquiryTest : BunqSdkTestBase
/// <summary>
/// Config values.
/// </summary>
private const string Amount = "0.01";
private const string Currency = "EUR";
private const string Description = "C# test Payment";
private const string Status = "ACCEPTED";
private const string RequestInquiryAmountEur = "0.01";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd change naming to something like ValueAmountEur (indicating that it is a value to be used in the test). RequestInquiryStatus looks a lot like the actual status objects now imo (@OGKevin 👀 )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sandervdo Argh you have a point 😭 stupid naming convention. @AnTao lets group these values by Value then 😒

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change this group with the keyword 'Value' then. 👍 @OGKevin @sandervdo is there a coding style guide available? That would be 👌

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm No there is no coding style publicly available. ATM we have a mixture of the Microsoft Conde stye and or own. E.g. the constants grouping and no plurals. Might be a good idea to write a wiki about the code style 👍

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, last question. Shall we also change the constants to contain 'Value' grouping in the test sample classes? Thanks guys!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, lets be consistent 👍

And thank you 🤗

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, last remark, Imho I believe we should use Value group in AmountEur or CurrencyEur in the case of this constants. And also group with value Field for others used in Field constants. What do you think ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example: image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All Status and description are not fields tho, those are also values 😁 .

A field typically looks like this:

        public const string FieldStatus = "status";

Instead of the actual value that the status field will hold, in this case ACCEPTED.

private const string RequestInquiryCurrency = "EUR";
private const string RequestInquiryDescription = "C# test Payment";
private const string RequestInquiryStatus = "ACCEPTED";
private const int IndexFirst = 0;

private static readonly int UserId = Config.GetUserId();
Expand All @@ -30,7 +30,7 @@ public class RequestInquiryTest : BunqSdkTestBase
/// <summary>
/// API context to use for the test API calls.
/// </summary>
private static readonly ApiContext API_CONTEXT = GetApiContext();
private static readonly ApiContext ApiContext = GetApiContext();

/// <summary>
/// Tests sending a request from monetary account 1 to monetary account 2 and accepting this request.
Expand All @@ -40,28 +40,27 @@ public void TestRequestInquiry()
{
var requestMap = new Dictionary<string, object>
{
{RequestInquiry.FIELD_AMOUNT_INQUIRED, new Amount(Amount, Currency)},
{RequestInquiry.FIELD_AMOUNT_INQUIRED, new Amount(RequestInquiryAmountEur, RequestInquiryCurrency)},
{RequestInquiry.FIELD_COUNTERPARTY_ALIAS, CounterSelfParty},
{RequestInquiry.FIELD_DESCRIPTION, Description},
{RequestInquiry.FIELD_DESCRIPTION, RequestInquiryDescription},
{RequestInquiry.FIELD_ALLOW_BUNQME, false}
};

RequestInquiry.Create(API_CONTEXT, requestMap, UserId, MonetaryAccountId);
RequestInquiry.Create(ApiContext, requestMap, UserId, MonetaryAccountId);

Assert.Equal(Status, AcceptRequest());
Assert.Equal(RequestInquiryStatus, AcceptRequest());
}

private static string AcceptRequest()
{
var requestResponseId = RequestResponse
.List(API_CONTEXT, UserId, SecondMonetaryAccountId).Value[IndexFirst].Id.Value;
var requestResponseId = RequestResponse.List(ApiContext, UserId, SecondMonetaryAccountId).Value[IndexFirst].Id.Value;

var requestMap = new Dictionary<string, object>
{
{RequestResponse.FIELD_STATUS, Status}
{RequestResponse.FIELD_STATUS, RequestInquiryStatus}
};

return RequestResponse.Update(API_CONTEXT, requestMap, UserId, SecondMonetaryAccountId,
return RequestResponse.Update(ApiContext, requestMap, UserId, SecondMonetaryAccountId,
requestResponseId).Value.Status;
}
}
Expand Down
24 changes: 12 additions & 12 deletions BunqSdk.Tests/Model/Generated/Endpoint/TabUsageSingleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public class TabUsageSingleTest : BunqSdkTestBase
/// <summary>
/// Config values
/// </summary>
private const string TabDescription = "Pay the tab for Java test please.";
private const string StatusOpen = "OPEN";
private const string Amount = "42.00";
private const string Currency = "EUR";
private const string TabItemDescription = "Super expensive java tea";
private const string StatusWaiting = "WAITING_FOR_PAYMENT";
private const string TabUsageSingleDescription = "Pay the tab for Java test please.";
private const string TabUsageSingleStatusOpen = "OPEN";
private const string TabAmountEur = "42.00";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please be consistent 😝 TabAmountEur -> TabUsageSingleAmountEur

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constant is also used along with the TabItemShop entity. Changing it for consistency!

private const string TabCurrency = "EUR";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please suffix Eur and consistency

private const string TabItemShopDescription = "Super expensive java tea";
private const string TabUsageSingleStatusWaiting = "WAITING_FOR_PAYMENT";

private static readonly int UserId = Config.GetUserId();
private static readonly int MonetaryAccountId = Config.GetMonetarytAccountId();
Expand All @@ -46,7 +46,7 @@ public void TestCreateTabAndUpdate()

var updateTabMap = new Dictionary<string, object>
{
{TabUsageSingle.FIELD_STATUS, StatusWaiting}
{TabUsageSingle.FIELD_STATUS, TabUsageSingleStatusWaiting}
};
TabUsageSingle.Update(ApiContext, updateTabMap, UserId, MonetaryAccountId, CashRegisterId, tabUuid);

Expand All @@ -62,9 +62,9 @@ private static string CreateTabAndGetUuid()
{
var createTabMap = new Dictionary<string, object>
{
{TabUsageSingle.FIELD_DESCRIPTION, TabDescription},
{TabUsageSingle.FIELD_STATUS, StatusOpen},
{TabUsageSingle.FIELD_AMOUNT_TOTAL, new Amount(Amount, Currency)}
{TabUsageSingle.FIELD_DESCRIPTION, TabUsageSingleDescription},
{TabUsageSingle.FIELD_STATUS, TabUsageSingleStatusOpen},
{TabUsageSingle.FIELD_AMOUNT_TOTAL, new Amount(TabAmountEur, TabCurrency)}
};

return TabUsageSingle.Create(ApiContext, createTabMap, UserId, MonetaryAccountId,
Expand All @@ -75,8 +75,8 @@ private static void AddTabItem(string tabUuid)
{
var tabItemMap = new Dictionary<string, object>
{
{TabItemShop.FIELD_AMOUNT, new Amount(Amount, Currency)},
{TabItemShop.FIELD_DESCRIPTION, TabItemDescription}
{TabItemShop.FIELD_AMOUNT, new Amount(TabAmountEur, TabCurrency)},
{TabItemShop.FIELD_DESCRIPTION, TabItemShopDescription}
};
TabItemShop.Create(ApiContext, tabItemMap, UserId, MonetaryAccountId, CashRegisterId, tabUuid);
}
Expand Down