Skip to content

Commit e09cf99

Browse files
committed
refactor: cleanup
1 parent de0c31c commit e09cf99

7 files changed

Lines changed: 50 additions & 44 deletions

File tree

tests/ByteSync.Client.IntegrationTests/Services/Actions/TestSharedAtomicActionComputer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using ByteSync.Models.Comparisons.Result;
1414
using ByteSync.Repositories;
1515
using ByteSync.Services.Actions;
16-
using ByteSync.Services.Comparisons;
1716
using ByteSync.Services.Sessions;
1817
using ByteSync.TestsCommon;
1918
using FluentAssertions;

tests/ByteSync.Client.IntegrationTests/Services/Dialogs/DialogService_HeadlessTests.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System.Collections.Generic;
2-
using System.Threading.Tasks;
31
using Autofac;
42
using ByteSync.Business;
53
using ByteSync.Client.IntegrationTests.TestHelpers;
@@ -8,7 +6,6 @@
86
using ByteSync.Services.Dialogs;
97
using ByteSync.ViewModels.Misc;
108
using Moq;
11-
using NUnit.Framework;
129

1310
namespace ByteSync.Client.IntegrationTests.Services.Dialogs;
1411

tests/ByteSync.Client.IntegrationTests/Services/Navigations/NavigationService_HeadlessTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using ByteSync.Client.IntegrationTests.TestHelpers;
44
using ByteSync.Interfaces.Controls.Navigations;
55
using ByteSync.Services.Navigations;
6-
using NUnit.Framework;
76

87
namespace ByteSync.Client.IntegrationTests.Services.Navigations;
98

tests/ByteSync.Client.IntegrationTests/Services/R2DownloadResume_Tests.cs

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
using Autofac;
2+
using ByteSync.Business.Actions.Shared;
3+
using ByteSync.Business.Inventories;
24
using ByteSync.Client.IntegrationTests.TestHelpers;
35
using ByteSync.Common.Business.SharedFiles;
46
using ByteSync.DependencyInjection;
5-
using ByteSync.Factories;
67
using ByteSync.Interfaces.Controls.Communications.Http;
78
using ByteSync.Interfaces.Factories;
89
using ByteSync.ServerCommon.Interfaces.Services.Storage;
910
using ByteSync.ServerCommon.Interfaces.Services.Storage.Factories;
1011
using ByteSync.ServerCommon.Services.Storage;
1112
using ByteSync.ServerCommon.Services.Storage.Factories;
1213
using ByteSync.Client.IntegrationTests.TestHelpers.Http;
14+
using ByteSync.Common.Business.Actions;
15+
using ByteSync.Common.Business.Inventories;
16+
using ByteSync.Interfaces.Repositories;
17+
using ByteSync.Interfaces.Services.Communications;
18+
using ByteSync.Interfaces.Services.Sessions;
19+
using ByteSync.ServerCommon.Business.Settings;
1320

1421
namespace ByteSync.Client.IntegrationTests.Services;
1522

@@ -34,14 +41,14 @@ public void SetUp()
3441

3542
b.RegisterType<CloudflareR2ClientFactory>().As<ICloudflareR2ClientFactory>().SingleInstance();
3643
b.RegisterType<CloudflareR2Service>().As<ICloudflareR2Service>().SingleInstance();
37-
b.Register(_ => GlobalTestSetup.Container.Resolve<Microsoft.Extensions.Options.IOptions<ByteSync.ServerCommon.Business.Settings.CloudflareR2Settings>>())
38-
.As<Microsoft.Extensions.Options.IOptions<ByteSync.ServerCommon.Business.Settings.CloudflareR2Settings>>();
44+
b.Register(_ => GlobalTestSetup.Container.Resolve<Microsoft.Extensions.Options.IOptions<CloudflareR2Settings>>())
45+
.As<Microsoft.Extensions.Options.IOptions<CloudflareR2Settings>>();
3946
b.RegisterType<R2FileTransferApiClient>().As<IFileTransferApiClient>().SingleInstance();
4047
});
4148

4249
// Set AES key for encryption/decryption used by SlicerEncrypter
4350
using var scope = _clientScope.BeginLifetimeScope();
44-
var cloudSessionConnectionRepository = scope.Resolve<ByteSync.Interfaces.Repositories.ICloudSessionConnectionRepository>();
51+
var cloudSessionConnectionRepository = scope.Resolve<ICloudSessionConnectionRepository>();
4552
cloudSessionConnectionRepository.SetAesEncryptionKey(AesGenerator.GenerateKey());
4653
}
4754

@@ -60,9 +67,9 @@ public async Task Download_WithTransientFailure_Should_Retry_And_Succeed()
6067
var uploaderFactory = scope.Resolve<IFileUploaderFactory>();
6168
var downloaderFactory = scope.Resolve<IFileDownloaderFactory>();
6269
var r2Service = scope.Resolve<ICloudflareR2Service>();
63-
var sharedActionsGroupRepository = scope.Resolve<ByteSync.Interfaces.Repositories.ISharedActionsGroupRepository>();
64-
var sessionService = scope.Resolve<ByteSync.Interfaces.Services.Sessions.ISessionService>();
65-
var connectionService = scope.Resolve<ByteSync.Interfaces.Services.Communications.IConnectionService>();
70+
var sharedActionsGroupRepository = scope.Resolve<ISharedActionsGroupRepository>();
71+
var sessionService = scope.Resolve<ISessionService>();
72+
var connectionService = scope.Resolve<IConnectionService>();
6673

6774
var shared = new SharedFileDefinition
6875
{
@@ -83,29 +90,29 @@ public async Task Download_WithTransientFailure_Should_Retry_And_Succeed()
8390
};
8491
await sessionService.SetSessionStatus(ByteSync.Business.Sessions.SessionStatus.Preparation);
8592

86-
var sag = new ByteSync.Business.Actions.Shared.SharedActionsGroup
93+
var sag = new SharedActionsGroup
8794
{
8895
ActionsGroupId = Guid.NewGuid().ToString("N"),
89-
SynchronizationType = Common.Business.Actions.SynchronizationTypes.Full,
90-
Source = new ByteSync.Business.Actions.Shared.SharedDataPart
96+
SynchronizationType = SynchronizationTypes.Full,
97+
Source = new SharedDataPart
9198
{
9299
ClientInstanceId = shared.ClientInstanceId,
93100
RootPath = Path.GetTempPath(),
94-
InventoryPartType = Common.Business.Inventories.FileSystemTypes.File,
101+
InventoryPartType = FileSystemTypes.File,
95102
Name = "itests",
96103
InventoryCodeAndId = "itests"
97104
},
98-
PathIdentity = new ByteSync.Business.Inventories.PathIdentity
105+
PathIdentity = new PathIdentity
99106
{
100-
FileSystemType = Common.Business.Inventories.FileSystemTypes.File,
107+
FileSystemType = FileSystemTypes.File,
101108
LinkingKeyValue = "itests"
102109
}
103110
};
104-
sag.Targets.Add(new ByteSync.Business.Actions.Shared.SharedDataPart
111+
sag.Targets.Add(new SharedDataPart
105112
{
106113
ClientInstanceId = shared.ClientInstanceId,
107114
RootPath = Path.GetTempFileName(),
108-
InventoryPartType = Common.Business.Inventories.FileSystemTypes.File,
115+
InventoryPartType = FileSystemTypes.File,
109116
Name = "itests",
110117
InventoryCodeAndId = "itests"
111118
});

tests/ByteSync.Client.IntegrationTests/Services/R2UploadDownload_Tests.cs

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
using Autofac;
2+
using ByteSync.Business.Actions.Shared;
3+
using ByteSync.Business.Inventories;
24
using ByteSync.Client.IntegrationTests.TestHelpers;
5+
using ByteSync.Common.Business.Inventories;
36
using ByteSync.Common.Business.SharedFiles;
47
using ByteSync.DependencyInjection;
5-
using ByteSync.Factories;
68
using ByteSync.Interfaces.Controls.Communications.Http;
79
using ByteSync.Interfaces.Factories;
10+
using ByteSync.Interfaces.Repositories;
11+
using ByteSync.Interfaces.Services.Communications;
12+
using ByteSync.Interfaces.Services.Sessions;
813
using ByteSync.ServerCommon.Interfaces.Services.Storage;
914
using ByteSync.ServerCommon.Interfaces.Services.Storage.Factories;
1015
using ByteSync.ServerCommon.Services.Storage;
1116
using ByteSync.ServerCommon.Services.Storage.Factories;
17+
using ByteSync.Services.Communications.Transfers;
1218

1319
namespace ByteSync.Client.IntegrationTests.Services;
1420

@@ -37,7 +43,7 @@ public void SetUp()
3743
// Set AES key for encryption/decryption used by SlicerEncrypter
3844
using var scope = _clientScope.BeginLifetimeScope();
3945
var cloudSessionConnectionRepository = scope.Resolve<ByteSync.Interfaces.Repositories.ICloudSessionConnectionRepository>();
40-
cloudSessionConnectionRepository.SetAesEncryptionKey(ByteSync.Client.IntegrationTests.TestHelpers.AesGenerator.GenerateKey());
46+
cloudSessionConnectionRepository.SetAesEncryptionKey(AesGenerator.GenerateKey());
4147
}
4248

4349
[TearDown]
@@ -56,9 +62,9 @@ public async Task Upload_Then_Download_Should_Succeed_With_Small_Chunks()
5662
var uploaderFactory = scope.Resolve<IFileUploaderFactory>();
5763
var downloaderFactory = scope.Resolve<IFileDownloaderFactory>();
5864
var r2Service = scope.Resolve<ICloudflareR2Service>();
59-
var sharedActionsGroupRepository = scope.Resolve<ByteSync.Interfaces.Repositories.ISharedActionsGroupRepository>();
60-
var sessionService = scope.Resolve<ByteSync.Interfaces.Services.Sessions.ISessionService>();
61-
var connectionService = scope.Resolve<ByteSync.Interfaces.Services.Communications.IConnectionService>();
65+
var sharedActionsGroupRepository = scope.Resolve<ISharedActionsGroupRepository>();
66+
var sessionService = scope.Resolve<ISessionService>();
67+
var connectionService = scope.Resolve<IConnectionService>();
6268

6369
var shared = new SharedFileDefinition
6470
{
@@ -76,40 +82,40 @@ public async Task Upload_Then_Download_Should_Succeed_With_Small_Chunks()
7682
ClientId = shared.ClientInstanceId,
7783
Version = "itests",
7884
IpAddress = "127.0.0.1",
79-
OSPlatform = ByteSync.Common.Business.Misc.OSPlatforms.Windows
85+
OSPlatform = Common.Business.Misc.OSPlatforms.Windows
8086
};
8187
await sessionService.SetSessionStatus(ByteSync.Business.Sessions.SessionStatus.Preparation);
8288

83-
var sag = new ByteSync.Business.Actions.Shared.SharedActionsGroup
89+
var sag = new SharedActionsGroup
8490
{
8591
ActionsGroupId = Guid.NewGuid().ToString("N"),
86-
SynchronizationType = ByteSync.Common.Business.Actions.SynchronizationTypes.Full,
87-
Source = new ByteSync.Business.Actions.Shared.SharedDataPart
92+
SynchronizationType = Common.Business.Actions.SynchronizationTypes.Full,
93+
Source = new SharedDataPart
8894
{
8995
ClientInstanceId = shared.ClientInstanceId,
9096
RootPath = Path.GetTempPath(),
91-
InventoryPartType = ByteSync.Common.Business.Inventories.FileSystemTypes.File,
97+
InventoryPartType = FileSystemTypes.File,
9298
Name = "itests",
9399
InventoryCodeAndId = "itests"
94100
},
95-
PathIdentity = new ByteSync.Business.Inventories.PathIdentity
101+
PathIdentity = new PathIdentity
96102
{
97-
FileSystemType = ByteSync.Common.Business.Inventories.FileSystemTypes.File,
103+
FileSystemType = FileSystemTypes.File,
98104
LinkingKeyValue = "itests"
99105
}
100106
};
101-
sag.Targets.Add(new ByteSync.Business.Actions.Shared.SharedDataPart
107+
sag.Targets.Add(new SharedDataPart
102108
{
103109
ClientInstanceId = shared.ClientInstanceId,
104110
RootPath = Path.GetTempFileName(),
105-
InventoryPartType = ByteSync.Common.Business.Inventories.FileSystemTypes.File,
111+
InventoryPartType = FileSystemTypes.File,
106112
Name = "itests",
107113
InventoryCodeAndId = "itests"
108114
});
109115
shared.ActionsGroupIds = [sag.ActionsGroupId];
110116
sharedActionsGroupRepository.SetSharedActionsGroups([sag]);
111117

112-
var inputContent = new string('x', 1_500_000);
118+
var inputContent = new string('x', 1_000_000);
113119
var tempFile = Path.GetTempFileName();
114120
await File.WriteAllTextAsync(tempFile, inputContent);
115121

@@ -129,7 +135,7 @@ public async Task Upload_Then_Download_Should_Succeed_With_Small_Chunks()
129135
}
130136
await downloader.PartsCoordinator.SetAllPartsKnownAsync(partsCount);
131137
await downloader.WaitForFileFullyExtracted();
132-
(downloader as ByteSync.Services.Communications.Transfers.FileDownloader)?.CleanupResources();
138+
(downloader as FileDownloader)?.CleanupResources();
133139

134140
// Cleanup uploaded objects for this test
135141
var prefix = shared.SessionId + "_" + shared.ClientInstanceId + "_";

tests/ByteSync.Client.IntegrationTests/Services/R2UploadResume_Tests.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
using ByteSync.Client.IntegrationTests.TestHelpers;
33
using ByteSync.Common.Business.SharedFiles;
44
using ByteSync.DependencyInjection;
5-
using ByteSync.Factories;
65
using ByteSync.Interfaces.Controls.Communications.Http;
76
using ByteSync.Interfaces.Factories;
87
using ByteSync.ServerCommon.Interfaces.Services.Storage;
98
using ByteSync.ServerCommon.Interfaces.Services.Storage.Factories;
109
using ByteSync.ServerCommon.Services.Storage;
1110
using ByteSync.ServerCommon.Services.Storage.Factories;
1211
using ByteSync.Client.IntegrationTests.TestHelpers.Http;
12+
using ByteSync.Interfaces.Repositories;
13+
using ByteSync.ServerCommon.Business.Settings;
1314

1415
namespace ByteSync.Client.IntegrationTests.Services;
1516

@@ -34,14 +35,14 @@ public void SetUp()
3435

3536
b.RegisterType<CloudflareR2ClientFactory>().As<ICloudflareR2ClientFactory>().SingleInstance();
3637
b.RegisterType<CloudflareR2Service>().As<ICloudflareR2Service>().SingleInstance();
37-
b.Register(_ => GlobalTestSetup.Container.Resolve<Microsoft.Extensions.Options.IOptions<ByteSync.ServerCommon.Business.Settings.CloudflareR2Settings>>())
38-
.As<Microsoft.Extensions.Options.IOptions<ByteSync.ServerCommon.Business.Settings.CloudflareR2Settings>>();
38+
b.Register(_ => GlobalTestSetup.Container.Resolve<CloudflareR2Settings>())
39+
.As<Microsoft.Extensions.Options.IOptions<CloudflareR2Settings>>();
3940
b.RegisterType<R2FileTransferApiClient>().As<IFileTransferApiClient>().SingleInstance();
4041
});
4142

4243
// Set AES key for encryption/decryption used by SlicerEncrypter
4344
using var scope = _clientScope.BeginLifetimeScope();
44-
var cloudSessionConnectionRepository = scope.Resolve<ByteSync.Interfaces.Repositories.ICloudSessionConnectionRepository>();
45+
var cloudSessionConnectionRepository = scope.Resolve<ICloudSessionConnectionRepository>();
4546
cloudSessionConnectionRepository.SetAesEncryptionKey(AesGenerator.GenerateKey());
4647
}
4748

tests/ByteSync.Client.IntegrationTests/Services/Updates/TestDeleteUpdateBackupSnippetsService.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
using System.Runtime.InteropServices;
2-
using Autofac;
1+
using Autofac;
32
using ByteSync.Business.Updates;
4-
using ByteSync.Client.IntegrationTests.TestHelpers;
5-
using ByteSync.Interfaces.Controls.Applications;
63
using ByteSync.Interfaces.Updates;
74
using ByteSync.Services.Updates;
85
using ByteSync.TestsCommon;

0 commit comments

Comments
 (0)