Skip to content

Commit b9be9d9

Browse files
authored
Maximize tests parallelization (#194)
1 parent d3d05de commit b9be9d9

File tree

7 files changed

+33
-37
lines changed

7 files changed

+33
-37
lines changed

MegaApiClient.Tests/Context/AnonymousTestContext.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
using System.Collections.Generic;
22
using System.Linq;
3-
using Xunit;
43

54
namespace CG.Web.MegaApiClient.Tests.Context
65
{
7-
[CollectionDefinition(nameof(AnonymousTestContext))]
8-
public class AnonymousLoginTestsCollection : ICollectionFixture<AnonymousTestContext> { }
9-
106
public class AnonymousTestContext : TestContext
117
{
128
protected override void ConnectClient(IMegaApiClient client)

MegaApiClient.Tests/DownloadUploadAnonymous.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
namespace CG.Web.MegaApiClient.Tests
66
{
7-
[Collection(nameof(AnonymousTestContext))]
7+
[CollectionDefinition(nameof(DownloadUploadAnonymous))]
8+
public class DownloadUploadAnonymousTestsCollection : ICollectionFixture<AnonymousTestContext> { }
9+
10+
[Collection(nameof(DownloadUploadAnonymous))]
811
public class DownloadUploadAnonymous : DownloadUpload
912
{
1013
public DownloadUploadAnonymous(AnonymousTestContext context, ITestOutputHelper testOutputHelper)

MegaApiClient.Tests/Login.cs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -248,22 +248,6 @@ public static IEnumerable<object[]> MethodsWithMandatoryLogin()
248248
yield return new object[] { (Action<IMegaApiClient>)(x => x.GetAccountInformation()) };
249249
}
250250

251-
[Theory, MemberData(nameof(GetCredentials), false)]
252-
public void GetAccountInformation_AuthenticatedUser_Succeeds(string email, string password)
253-
{
254-
Context.Client.Login(email, password);
255-
256-
var authenticatedTestContext = new AuthenticatedTestContext();
257-
var protectedNodes = authenticatedTestContext.ProtectedNodes;
258-
SanitizeStorage(protectedNodes);
259-
260-
var accountInformation = Context.Client.GetAccountInformation();
261-
262-
Assert.NotNull(accountInformation);
263-
Assert.Equal(AuthenticatedTestContext.Inputs.TotalQuota, accountInformation.TotalQuota);
264-
Assert.Equal(AuthenticatedTestContext.Inputs.SharedFile.Size + AuthenticatedTestContext.Inputs.SharedFileUpSideDown.Size + AuthenticatedTestContext.Inputs.SampleZipFile.Size, accountInformation.UsedQuota);
265-
}
266-
267251
[Theory, MemberData(nameof(GetCredentials), false)]
268252
public void GetSessionHistory_AuthenticatedUser_Succeeds(string email, string password)
269253
{
@@ -278,17 +262,5 @@ public void GetSessionHistory_AuthenticatedUser_Succeeds(string email, string pa
278262
Assert.Equal(DateTime.UtcNow, first.LoginTime.ToUniversalTime(), TimeSpan.FromSeconds(30));
279263
Assert.Equal(DateTime.UtcNow, first.LastSeenTime.ToUniversalTime(), TimeSpan.FromSeconds(30));
280264
}
281-
282-
[Fact]
283-
public void GetAccountInformation_AnonymousUser_Succeeds()
284-
{
285-
Context.Client.LoginAnonymous();
286-
287-
var accountInformation = Context.Client.GetAccountInformation();
288-
289-
Assert.NotNull(accountInformation);
290-
Assert.Equal(AuthenticatedTestContext.Inputs.TotalQuota, accountInformation.TotalQuota);
291-
Assert.Equal(0, accountInformation.UsedQuota);
292-
}
293265
}
294266
}

MegaApiClient.Tests/NodeOperationsAnonymous.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,25 @@
44

55
namespace CG.Web.MegaApiClient.Tests
66
{
7-
[Collection(nameof(AnonymousTestContext))]
7+
[CollectionDefinition(nameof(NodeOperationsAnonymous))]
8+
public class NodeOperationsAnonymousTestsCollection : ICollectionFixture<AnonymousTestContext> { }
9+
10+
[Collection(nameof(NodeOperationsAnonymous))]
811
public class NodeOperationsAnonymous : NodeOperations
912
{
1013
public NodeOperationsAnonymous(AnonymousTestContext context, ITestOutputHelper testOutputHelper)
1114
: base(context, testOutputHelper)
1215
{
1316
}
17+
18+
[Fact]
19+
public void GetAccountInformation_AnonymousUser_Succeeds()
20+
{
21+
var accountInformation = Context.Client.GetAccountInformation();
22+
23+
Assert.NotNull(accountInformation);
24+
Assert.Equal(AuthenticatedTestContext.Inputs.TotalQuota, accountInformation.TotalQuota);
25+
Assert.Equal(0, accountInformation.UsedQuota);
26+
}
1427
}
1528
}

MegaApiClient.Tests/NodeOperationsAnonymousAsync.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
namespace CG.Web.MegaApiClient.Tests
66
{
7-
[Collection(nameof(AnonymousAsyncTestContext))]
7+
[CollectionDefinition(nameof(NodeOperationsAnonymousAsync))]
8+
public class NodeOperationsAnonymousAsyncTestsCollection : ICollectionFixture<AnonymousAsyncTestContext> { }
9+
10+
[Collection(nameof(NodeOperationsAnonymousAsync))]
811
public class NodeOperationsAnonymousAsync : NodeOperations
912
{
1013
public NodeOperationsAnonymousAsync(AnonymousAsyncTestContext context, ITestOutputHelper testOutputHelper)

MegaApiClient.Tests/NodeOperationsAuthenticated.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,15 @@ public void GetFileAttributes_FromNode_Succeeds()
105105
Assert.Equal(AuthenticatedTestContext.Inputs.SharedFile.Preview.AttributeId, fileAttribute.Id);
106106
Assert.Equal(FileAttributeType.Preview, fileAttribute.Type);
107107
}
108+
109+
[Fact]
110+
public void GetAccountInformation_AuthenticatedUser_Succeeds()
111+
{
112+
var accountInformation = Context.Client.GetAccountInformation();
113+
114+
Assert.NotNull(accountInformation);
115+
Assert.Equal(AuthenticatedTestContext.Inputs.TotalQuota, accountInformation.TotalQuota);
116+
Assert.Equal(AuthenticatedTestContext.Inputs.SharedFile.Size + AuthenticatedTestContext.Inputs.SharedFileUpSideDown.Size + AuthenticatedTestContext.Inputs.SampleZipFile.Size, accountInformation.UsedQuota);
117+
}
108118
}
109119
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
22
"$schema": "https://xunit.net/schema/current/xunit.runner.schema.json",
3-
"shadowCopy": false,
4-
"parallelizeTestCollections": false
3+
"shadowCopy": false
54
}

0 commit comments

Comments
 (0)