Skip to content

Commit 5b21242

Browse files
Merge branch 'release/1.12.0'
Release 1.12.0
2 parents d532d15 + eede8dd commit 5b21242

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1500
-85
lines changed

.idea/.idea.BunqSdk/.idea/contentModel.xml

+33-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.BunqSdk/.idea/vcs.xml

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.BunqSdk/riderModule.iml

+6-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

BunqSdk.Tests/BunqSdk.Tests.csproj

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>netcoreapp1.1</TargetFramework>
43
<RootNamespace>Bunq.Sdk.Tests</RootNamespace>
54
<LangVersion>default</LangVersion>
65
<AssemblyName>BunqSdk.Tests.xunit.runner.json</AssemblyName>
6+
<TargetFramework>netcoreapp2.2</TargetFramework>
77
</PropertyGroup>
88
<ItemGroup>
99
<ProjectReference Include="..\BunqSdk\BunqSdk.csproj" />
1010
</ItemGroup>
1111
<ItemGroup>
1212
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-*" />
13-
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-*" />
14-
<PackageReference Include="xunit" Version="2.2.0-*" />
1513
<DotNetCliToolReference Include="dotnet-xunit" Version="2.2.0-*" />
14+
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
15+
<PackageReference Include="MSTest.TestFramework" Version="2.0.0-beta4" />
16+
<PackageReference Include="xunit" Version="2.4.1" />
17+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
18+
<PackageReference Include="xunit.runners" Version="2.0.0" />
1619
</ItemGroup>
1720
<ItemGroup>
1821
<Content Include="xunit.runner.json">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using Bunq.Sdk.Context;
5+
using Bunq.Sdk.Json;
6+
using Bunq.Sdk.Model.Generated.Endpoint;
7+
using Bunq.Sdk.Security;
8+
using Bunq.Sdk.Tests.Util;
9+
using Xunit;
10+
using Assert = Xunit.Assert;
11+
12+
namespace Bunq.Sdk.Tests.Context
13+
{
14+
[TestCaseOrderer("Bunq.Sdk.Tests.Util.TestPriorityOrderer", "Psd2ApiContextTest")]
15+
public class Psd2ApiContextTest: IClassFixture<Psd2ApiContextTest>
16+
{
17+
/// <summary>
18+
/// File constants.
19+
/// </summary>
20+
private const string FILE_TEST_CONFIGURATION = "../../../Resources/bunq-psd2-test.conf";
21+
private const string FILE_TEST_OAUTH = "../../../Resources/bunq-oauth-test.conf";
22+
23+
private const string FILE_TEST_CREDENTIALS = "../../../Resources/credentials.pfx";
24+
private const string FILE_TEST_CERTIFICATE_CHAIN = "../../../Resources/chain.cert";
25+
26+
/// <summary>
27+
/// Test constants.
28+
/// </summary>
29+
private const string TEST_DEVICE_DESCRIPTION = "PSD2TestDevice";
30+
private const string TEST_PASSPHRASE_CREDENTIALS = "secret";
31+
32+
[Fact, TestPriority(1)]
33+
public void TestCreatePsd2Context()
34+
{
35+
ApiContext apiContext = null;
36+
if (File.Exists(FILE_TEST_CONFIGURATION))
37+
{
38+
apiContext = ApiContext.Restore(FILE_TEST_CONFIGURATION);
39+
Assert.NotNull(apiContext);
40+
41+
BunqContext.LoadApiContext(apiContext);
42+
return;
43+
}
44+
45+
apiContext = CreateApiContext();
46+
BunqContext.LoadApiContext(apiContext);
47+
48+
Assert.True(File.Exists(FILE_TEST_CONFIGURATION));
49+
}
50+
51+
[Fact, TestPriority(0)]
52+
public void TestCreateOauthClient()
53+
{
54+
if (File.Exists(FILE_TEST_OAUTH))
55+
{
56+
return;
57+
}
58+
59+
int clientId = OauthClient.Create().Value;
60+
OauthClient oauthClient = OauthClient.Get(clientId).Value;
61+
Assert.NotNull(oauthClient);
62+
63+
File.WriteAllText(
64+
FILE_TEST_OAUTH,
65+
BunqJsonConvert.SerializeObject(oauthClient)
66+
);
67+
Assert.True(File.Exists(FILE_TEST_OAUTH));
68+
}
69+
70+
private ApiContext CreateApiContext()
71+
{
72+
ApiContext apiContext = ApiContext.CreateForPsd2(
73+
ApiEnvironmentType.SANDBOX,
74+
SecurityUtils.GetCertificateFromFile(FILE_TEST_CREDENTIALS, TEST_PASSPHRASE_CREDENTIALS),
75+
SecurityUtils.GetCertificateCollectionFromAllPath(
76+
new[] { FILE_TEST_CERTIFICATE_CHAIN }
77+
),
78+
TEST_DEVICE_DESCRIPTION,
79+
new List<string>()
80+
);
81+
apiContext.Save(FILE_TEST_CONFIGURATION);
82+
83+
return apiContext;
84+
}
85+
}
86+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
using System.Collections.Generic;
2+
using Bunq.Sdk.Context;
3+
using Bunq.Sdk.Model.Core;
4+
using Bunq.Sdk.Model.Generated.Endpoint;
5+
using Bunq.Sdk.Model.Generated.Object;
6+
using Xunit;
7+
8+
namespace Bunq.Sdk.Tests.Model.Core
9+
{
10+
/// <summary>
11+
/// Tests:
12+
/// NotificationFilterUrlMonetaryAccountInternal
13+
/// NotificationFilterUrlUserInternal
14+
/// NotificationFilterPushUserInternal
15+
/// </summary>
16+
public class NotificationFilterTest: BunqSdkTestBase, IClassFixture<NotificationFilterTest>
17+
{
18+
/// <summary>
19+
/// Filter constants.
20+
/// </summary>
21+
private const string FILTER_CATEGORY_MUTATION = "MUTATION";
22+
private const string FILTER_CALLBACK_URL = "https://test.com/callback";
23+
24+
/// <summary>
25+
/// Test NotificationFilterUrlMonetaryAccount creation.
26+
/// </summary>
27+
[Fact]
28+
public void TestNotificationFilterUrlMonetaryAccount()
29+
{
30+
SetUpApiContext();
31+
32+
NotificationFilterUrl notificationFilter = GetNotificationFilterUrl();
33+
List<NotificationFilterUrl> allCreatedNotificationFilter = NotificationFilterUrlMonetaryAccountInternal.CreateWithListResponse(
34+
GetPrimaryMonetaryAccount().Id.Value,
35+
new List<NotificationFilterUrl>() {notificationFilter}
36+
).Value;
37+
38+
Assert.True(allCreatedNotificationFilter.Count == 1);
39+
}
40+
41+
/// <summary>
42+
/// Test NotificationFilterUrlUser creation.
43+
/// </summary>
44+
[Fact]
45+
public void TestNotificationFilterUrlUser()
46+
{
47+
SetUpApiContext();
48+
49+
NotificationFilterUrl notificationFilter = GetNotificationFilterUrl();
50+
List<NotificationFilterUrl> allCreatedNotificationFilter = NotificationFilterUrlUserInternal.CreateWithListResponse(
51+
new List<NotificationFilterUrl>() {notificationFilter}
52+
).Value;
53+
54+
Assert.True(allCreatedNotificationFilter.Count == 1);
55+
}
56+
/// <summary>
57+
/// Test NotificationFilterPushUser creation.
58+
/// </summary>
59+
[Fact]
60+
public void TestNotificationFilterPushUser()
61+
{
62+
SetUpApiContext();
63+
64+
NotificationFilterPush notificationFilter = GetNotificationFilterPush();
65+
List<NotificationFilterPush> allCreatedNotificationFilter = NotificationFilterPushUserInternal.CreateWithListResponse(
66+
new List<NotificationFilterPush>() {notificationFilter}
67+
).Value;
68+
69+
Assert.True(allCreatedNotificationFilter.Count == 1);
70+
}
71+
72+
/// <summary>
73+
/// Test clear all filters.
74+
/// </summary>
75+
[Fact]
76+
public void TestNotificationFilterClear()
77+
{
78+
SetUpApiContext();
79+
80+
List<NotificationFilterPush> allCreatedNotificationFilterPushUser =
81+
NotificationFilterPushUserInternal.CreateWithListResponse().Value;
82+
List<NotificationFilterUrl> allCreatedNotificationFilterUrlUser =
83+
NotificationFilterUrlUserInternal.CreateWithListResponse().Value;
84+
List<NotificationFilterUrl> allCreatedNotificationFilterUrlMonetaryAccount =
85+
NotificationFilterUrlMonetaryAccountInternal.CreateWithListResponse().Value;
86+
87+
Assert.Empty(allCreatedNotificationFilterPushUser);
88+
Assert.Empty(allCreatedNotificationFilterUrlUser);
89+
Assert.Empty(allCreatedNotificationFilterUrlMonetaryAccount);
90+
91+
Assert.StrictEqual(0, NotificationFilterPushUserInternal.List().Value.Count);
92+
Assert.StrictEqual(0, NotificationFilterUrlUserInternal.List().Value.Count);
93+
Assert.StrictEqual(0, NotificationFilterUrlMonetaryAccountInternal.List().Value.Count);
94+
}
95+
96+
private NotificationFilterUrl GetNotificationFilterUrl()
97+
{
98+
return new NotificationFilterUrl(FILTER_CATEGORY_MUTATION, FILTER_CALLBACK_URL);
99+
}
100+
101+
private NotificationFilterPush GetNotificationFilterPush()
102+
{
103+
return new NotificationFilterPush(FILTER_CATEGORY_MUTATION);
104+
}
105+
106+
private MonetaryAccountBank GetPrimaryMonetaryAccount()
107+
{
108+
return BunqContext.UserContext.PrimaryMonetaryAccountBank;
109+
}
110+
}
111+
}

BunqSdk.Tests/Model/Generated/Endpoint/CardDebitTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public void TestOrderNewMaestroCard()
5353
var cardDebit = CardDebit.Create(
5454
GenerateRandomSecondLine(),
5555
GetAnAllowedName(),
56-
GetAlias(),
5756
CardTypeMaestro,
57+
GetAlias(),
5858
allCardPinAssignments
5959
).Value;
6060

0 commit comments

Comments
 (0)