mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 15:11:10 +00:00
Standardizes the remaining boolean names across the stack
This commit is contained in:
1 parent
3e0c3b624f
commit
39f4a04459
40 files changed
+1062
-448
No files matched your search
+14
-15
@@ -29,7 +29,6 @@ public class GetDirectoriesEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
private readonly FileSystemStructureFixture _fileSystemStructureFixture = new();
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
ReferenceHandler = ReferenceHandler.Preserve,
|
||||
PropertyNameCaseInsensitive = true,
|
||||
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
|
||||
};
|
||||
@@ -54,18 +53,18 @@ public class GetDirectoriesEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
}
|
||||
|
||||
[SkipWhenHiddenAttributeNotSupportedFact]
|
||||
public async Task GetDirectories_WhenCalledWithValidPathAndHiddenChildrenAndNotIncludeHiddenElements_ShouldReturnNoDirectories()
|
||||
public async Task GetDirectories_WhenCalledWithValidPathAndHiddenChildrenAndNotShouldIncludeHiddenElements_ShouldReturnNoDirectories()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = _fileSystemStructureFixture.CreateFileSystemStructure();
|
||||
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath;
|
||||
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // two levels to get to the element that has a hidden element as child
|
||||
string encodedPath = Uri.EscapeDataString(testPath);
|
||||
bool includeHiddenElements = false;
|
||||
bool shouldIncludeHiddenElements = false;
|
||||
try
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/directories/get-directories?path={encodedPath}&includeHiddenElements={includeHiddenElements}");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/directories/get-directories?path={encodedPath}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}");
|
||||
|
||||
// Assert
|
||||
string content = await response.Content.ReadAsStringAsync();
|
||||
@@ -84,18 +83,18 @@ public class GetDirectoriesEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetDirectories_WhenCalledWithValidPathAndWithIncludeHiddenElements_ShouldReturnDirectoriesWithHiddenElements()
|
||||
public async Task GetDirectories_WhenCalledWithValidPathAndWithShouldIncludeHiddenElements_ShouldReturnDirectoriesWithHiddenElements()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = _fileSystemStructureFixture.CreateFileSystemStructure();
|
||||
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath;
|
||||
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // two levels to get to the element that has a hidden element as child
|
||||
string encodedPath = Uri.EscapeDataString(testPath);
|
||||
bool includeHiddenElements = true;
|
||||
bool shouldIncludeHiddenElements = true;
|
||||
try
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/directories/get-directories?path={encodedPath}&includeHiddenElements={includeHiddenElements}");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/directories/get-directories?path={encodedPath}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}");
|
||||
|
||||
// Assert
|
||||
response.EnsureSuccessStatusCode();
|
||||
@@ -127,10 +126,10 @@ public class GetDirectoriesEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
// Arrange
|
||||
string invalidPath = "invalid:path";
|
||||
string encodedPath = Uri.EscapeDataString(invalidPath);
|
||||
bool includeHiddenElements = true;
|
||||
bool shouldIncludeHiddenElements = true;
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/directories/get-directories?path={encodedPath}&includeHiddenElements={includeHiddenElements}");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/directories/get-directories?path={encodedPath}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}");
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
|
||||
@@ -153,10 +152,10 @@ public class GetDirectoriesEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
// Arrange
|
||||
string emptyPath = "";
|
||||
string encodedPath = Uri.EscapeDataString(emptyPath);
|
||||
bool includeHiddenElements = true;
|
||||
bool shouldIncludeHiddenElements = true;
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/directories/get-directories?path={encodedPath}&includeHiddenElements={includeHiddenElements}");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/directories/get-directories?path={encodedPath}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}");
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.UnprocessableContent, response.StatusCode);
|
||||
@@ -184,12 +183,12 @@ public class GetDirectoriesEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "testDirectory");
|
||||
string encodedPath = Uri.EscapeDataString(testPath);
|
||||
bool includeHiddenElements = true;
|
||||
bool shouldIncludeHiddenElements = true;
|
||||
using CancellationTokenSource cts = new(TimeSpan.FromSeconds(5));
|
||||
|
||||
// Act & Assert
|
||||
Exception? exception = await Record.ExceptionAsync(async () =>
|
||||
await _client.GetAsync($"/api/v1/directories/get-directories?path={encodedPath}&includeHiddenElements={includeHiddenElements}", cts.Token)
|
||||
await _client.GetAsync($"/api/v1/directories/get-directories?path={encodedPath}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}", cts.Token)
|
||||
);
|
||||
Assert.Null(exception);
|
||||
}
|
||||
@@ -200,14 +199,14 @@ public class GetDirectoriesEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "testDirectory");
|
||||
string encodedPath = Uri.EscapeDataString(testPath);
|
||||
bool includeHiddenElements = true;
|
||||
bool shouldIncludeHiddenElements = true;
|
||||
using CancellationTokenSource cts = new();
|
||||
|
||||
// Act & Assert
|
||||
await Assert.ThrowsAsync<TaskCanceledException>(async () =>
|
||||
{
|
||||
cts.Cancel();
|
||||
await _client.GetAsync($"/api/v1/directories/get-directories?path={encodedPath}&includeHiddenElements={includeHiddenElements}", cts.Token);
|
||||
await _client.GetAsync($"/api/v1/directories/get-directories?path={encodedPath}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}", cts.Token);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+17
-18
@@ -29,7 +29,6 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
private readonly FileSystemStructureFixture _fileSystemStructureFixture = new();
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
ReferenceHandler = ReferenceHandler.Preserve,
|
||||
PropertyNameCaseInsensitive = true,
|
||||
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
|
||||
};
|
||||
@@ -54,16 +53,16 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[SkipWhenHiddenAttributeNotSupportedFact]
|
||||
public async Task GetFiles_WhenCalledWithValidPathAndNotIncludeHiddenElements_ShouldReturnFilesWithoutHiddenElements()
|
||||
public async Task GetFiles_WhenCalledWithValidPathAndNotShouldIncludeHiddenElements_ShouldReturnFilesWithoutHiddenElements()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = _fileSystemStructureFixture.CreateFileSystemStructure();
|
||||
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath;
|
||||
bool includeHiddenElements = false;
|
||||
bool shouldIncludeHiddenElements = false;
|
||||
try
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-files?path={Uri.EscapeDataString(testPath)}&includeHiddenElements={includeHiddenElements}");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-files?path={Uri.EscapeDataString(testPath)}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}");
|
||||
|
||||
// Assert
|
||||
response.EnsureSuccessStatusCode();
|
||||
@@ -90,17 +89,17 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[SkipWhenHiddenAttributeNotSupportedFact]
|
||||
public async Task GetFiles_WhenCalledWithValidPathAndHiddenChildrenAndNotIncludeHiddenElements_ShouldReturnNoFiles()
|
||||
public async Task GetFiles_WhenCalledWithValidPathAndHiddenChildrenAndNotShouldIncludeHiddenElements_ShouldReturnNoFiles()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = _fileSystemStructureFixture.CreateFileSystemStructure();
|
||||
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath;
|
||||
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // two levels to get to the element that has a hidden element as child
|
||||
bool includeHiddenElements = false;
|
||||
bool shouldIncludeHiddenElements = false;
|
||||
try
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-files?path={Uri.EscapeDataString(testPath)}&includeHiddenElements={includeHiddenElements}");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-files?path={Uri.EscapeDataString(testPath)}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}");
|
||||
|
||||
// Assert
|
||||
response.EnsureSuccessStatusCode();
|
||||
@@ -121,17 +120,17 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetFiles_WhenCalledWithValidPathAndWithIncludeHiddenElements_ShouldReturnFilesWithHiddenElements()
|
||||
public async Task GetFiles_WhenCalledWithValidPathAndWithShouldIncludeHiddenElements_ShouldReturnFilesWithHiddenElements()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = _fileSystemStructureFixture.CreateFileSystemStructure();
|
||||
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath;
|
||||
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // two levels to get to the element that has a hidden element as child
|
||||
bool includeHiddenElements = true;
|
||||
bool shouldIncludeHiddenElements = true;
|
||||
try
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-files?path={Uri.EscapeDataString(testPath)}&includeHiddenElements={includeHiddenElements}");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-files?path={Uri.EscapeDataString(testPath)}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}");
|
||||
|
||||
// Assert
|
||||
response.EnsureSuccessStatusCode();
|
||||
@@ -166,10 +165,10 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
// Arrange
|
||||
string invalidPath = "invalid:path";
|
||||
string encodedPath = Uri.EscapeDataString(invalidPath);
|
||||
bool includeHiddenElements = true;
|
||||
bool shouldIncludeHiddenElements = true;
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-files?path={encodedPath}&includeHiddenElements={includeHiddenElements}");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-files?path={encodedPath}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}");
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
|
||||
@@ -192,10 +191,10 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
// Arrange
|
||||
string emptyPath = "";
|
||||
string encodedPath = Uri.EscapeDataString(emptyPath);
|
||||
bool includeHiddenElements = true;
|
||||
bool shouldIncludeHiddenElements = true;
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-files?path={encodedPath}&includeHiddenElements={includeHiddenElements}");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-files?path={encodedPath}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}");
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.UnprocessableContent, response.StatusCode);
|
||||
@@ -223,12 +222,12 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "testDirectory");
|
||||
string encodedPath = Uri.EscapeDataString(testPath);
|
||||
bool includeHiddenElements = true;
|
||||
bool shouldIncludeHiddenElements = true;
|
||||
using CancellationTokenSource cts = new(TimeSpan.FromSeconds(5));
|
||||
|
||||
// Act & Assert
|
||||
Exception? exception = await Record.ExceptionAsync(async () =>
|
||||
await _client.GetAsync($"/api/v1/files/get-files?path={encodedPath}&includeHiddenElements={includeHiddenElements}", cts.Token)
|
||||
await _client.GetAsync($"/api/v1/files/get-files?path={encodedPath}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}", cts.Token)
|
||||
);
|
||||
Assert.Null(exception);
|
||||
}
|
||||
@@ -239,14 +238,14 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "testDirectory");
|
||||
string encodedPath = Uri.EscapeDataString(testPath);
|
||||
bool includeHiddenElements = true;
|
||||
bool shouldIncludeHiddenElements = true;
|
||||
using CancellationTokenSource cts = new();
|
||||
|
||||
// Act & Assert
|
||||
Exception? exception = await Record.ExceptionAsync(async () =>
|
||||
{
|
||||
cts.Cancel();
|
||||
await _client.GetAsync($"/api/v1/files/get-files?path={encodedPath}&includeHiddenElements={includeHiddenElements}", cts.Token);
|
||||
await _client.GetAsync($"/api/v1/files/get-files?path={encodedPath}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}", cts.Token);
|
||||
});
|
||||
Assert.IsType<TaskCanceledException>(exception);
|
||||
}
|
||||
|
||||
+17
-18
@@ -29,7 +29,6 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
private readonly FileSystemStructureFixture _fileSystemStructureFixture = new();
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
ReferenceHandler = ReferenceHandler.Preserve,
|
||||
PropertyNameCaseInsensitive = true,
|
||||
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
|
||||
};
|
||||
@@ -54,16 +53,16 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[SkipWhenHiddenAttributeNotSupportedFact]
|
||||
public async Task GetTreeFiles_WhenCalledWithValidPathAndNotIncludeHiddenElements_ShouldReturnTreeFilesWithoutHiddenElements()
|
||||
public async Task GetTreeFiles_WhenCalledWithValidPathAndNotShouldIncludeHiddenElements_ShouldReturnTreeFilesWithoutHiddenElements()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = _fileSystemStructureFixture.CreateFileSystemStructure();
|
||||
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath;
|
||||
bool includeHiddenElements = false;
|
||||
bool shouldIncludeHiddenElements = false;
|
||||
try
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-tree-files?path={Uri.EscapeDataString(testPath)}&includeHiddenElements={includeHiddenElements}");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-tree-files?path={Uri.EscapeDataString(testPath)}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}");
|
||||
|
||||
// Assert
|
||||
response.EnsureSuccessStatusCode();
|
||||
@@ -90,17 +89,17 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[SkipWhenHiddenAttributeNotSupportedFact]
|
||||
public async Task GetTreeFiles_WhenCalledWithValidPathAndHiddenChildrenAndNotIncludeHiddenElements_ShouldReturnNoTreeFiles()
|
||||
public async Task GetTreeFiles_WhenCalledWithValidPathAndHiddenChildrenAndNotShouldIncludeHiddenElements_ShouldReturnNoTreeFiles()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = _fileSystemStructureFixture.CreateFileSystemStructure();
|
||||
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath;
|
||||
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // two levels to get to the element that has a hidden element as child
|
||||
bool includeHiddenElements = false;
|
||||
bool shouldIncludeHiddenElements = false;
|
||||
try
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-tree-files?path={Uri.EscapeDataString(testPath)}&includeHiddenElements={includeHiddenElements}");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-tree-files?path={Uri.EscapeDataString(testPath)}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}");
|
||||
|
||||
// Assert
|
||||
response.EnsureSuccessStatusCode();
|
||||
@@ -122,17 +121,17 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetTreeFiles_WhenCalledWithValidPathAndWithIncludeHiddenElements_ShouldReturnTreeFilesWithHiddenElements()
|
||||
public async Task GetTreeFiles_WhenCalledWithValidPathAndWithShouldIncludeHiddenElements_ShouldReturnTreeFilesWithHiddenElements()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = _fileSystemStructureFixture.CreateFileSystemStructure();
|
||||
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath;
|
||||
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // two levels to get to the element that has a hidden element as child
|
||||
bool includeHiddenElements = true;
|
||||
bool shouldIncludeHiddenElements = true;
|
||||
try
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-tree-files?path={Uri.EscapeDataString(testPath)}&includeHiddenElements={includeHiddenElements}");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-tree-files?path={Uri.EscapeDataString(testPath)}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}");
|
||||
|
||||
// Assert
|
||||
response.EnsureSuccessStatusCode();
|
||||
@@ -166,10 +165,10 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
// Arrange
|
||||
string invalidPath = "invalid:path";
|
||||
string encodedPath = Uri.EscapeDataString(invalidPath);
|
||||
bool includeHiddenElements = true;
|
||||
bool shouldIncludeHiddenElements = true;
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-tree-files?path={encodedPath}&includeHiddenElements={includeHiddenElements}");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-tree-files?path={encodedPath}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}");
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
|
||||
@@ -192,10 +191,10 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
// Arrange
|
||||
string emptyPath = "";
|
||||
string encodedPath = Uri.EscapeDataString(emptyPath);
|
||||
bool includeHiddenElements = true;
|
||||
bool shouldIncludeHiddenElements = true;
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-tree-files?path={encodedPath}&includeHiddenElements={includeHiddenElements}");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/files/get-tree-files?path={encodedPath}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}");
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.UnprocessableContent, response.StatusCode);
|
||||
@@ -223,12 +222,12 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "testDirectory");
|
||||
string encodedPath = Uri.EscapeDataString(testPath);
|
||||
bool includeHiddenElements = true;
|
||||
bool shouldIncludeHiddenElements = true;
|
||||
using CancellationTokenSource cts = new(TimeSpan.FromSeconds(5));
|
||||
|
||||
// Act & Assert
|
||||
Exception? exception = await Record.ExceptionAsync(async () =>
|
||||
await _client.GetAsync($"/api/v1/files/get-tree-files?path={encodedPath}&includeHiddenElements={includeHiddenElements}", cts.Token)
|
||||
await _client.GetAsync($"/api/v1/files/get-tree-files?path={encodedPath}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}", cts.Token)
|
||||
);
|
||||
Assert.Null(exception);
|
||||
}
|
||||
@@ -239,14 +238,14 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "testDirectory");
|
||||
string encodedPath = Uri.EscapeDataString(testPath);
|
||||
bool includeHiddenElements = true;
|
||||
bool shouldIncludeHiddenElements = true;
|
||||
using CancellationTokenSource cts = new();
|
||||
|
||||
// Act & Assert
|
||||
Exception? exception = await Record.ExceptionAsync(async () =>
|
||||
{
|
||||
cts.Cancel();
|
||||
await _client.GetAsync($"/api/v1/files/get-tree-files?path={encodedPath}&includeHiddenElements={includeHiddenElements}", cts.Token);
|
||||
await _client.GetAsync($"/api/v1/files/get-tree-files?path={encodedPath}&shouldIncludeHiddenElements={shouldIncludeHiddenElements}", cts.Token);
|
||||
});
|
||||
Assert.IsType<TaskCanceledException>(exception);
|
||||
}
|
||||
|
||||
+5
-6
@@ -25,7 +25,6 @@ public class CheckPathExistsEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
private readonly AuthenticatedLuminaApiFactory _apiFactory;
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
ReferenceHandler = ReferenceHandler.Preserve,
|
||||
PropertyNameCaseInsensitive = true,
|
||||
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
|
||||
};
|
||||
@@ -55,7 +54,7 @@ public class CheckPathExistsEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
string tempPath = System.IO.Path.GetTempPath();
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/path/check-path-exists?path={Uri.EscapeDataString(tempPath)}&includeHiddenElements=false");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/path/check-path-exists?path={Uri.EscapeDataString(tempPath)}&shouldIncludeHiddenElements=false");
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
@@ -72,7 +71,7 @@ public class CheckPathExistsEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
string nonExistingPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), Guid.NewGuid().ToString());
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/path/check-path-exists?path={Uri.EscapeDataString(nonExistingPath)}&includeHiddenElements=false");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/path/check-path-exists?path={Uri.EscapeDataString(nonExistingPath)}&shouldIncludeHiddenElements=false");
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
@@ -89,7 +88,7 @@ public class CheckPathExistsEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
string path = "";
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/path/check-path-exists?path={Uri.EscapeDataString(path)}&includeHiddenElements=false");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/path/check-path-exists?path={Uri.EscapeDataString(path)}&shouldIncludeHiddenElements=false");
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.UnprocessableContent, response.StatusCode);
|
||||
@@ -117,7 +116,7 @@ public class CheckPathExistsEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
string invalidPath = "invalid:path";
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/path/check-path-exists?path={Uri.EscapeDataString(invalidPath)}&includeHiddenElements=false");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/path/check-path-exists?path={Uri.EscapeDataString(invalidPath)}&shouldIncludeHiddenElements=false");
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
@@ -139,7 +138,7 @@ public class CheckPathExistsEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
Exception? exception = await Record.ExceptionAsync(async () =>
|
||||
{
|
||||
cts.Cancel();
|
||||
await _client.GetAsync($"/api/v1/path/check-path-exists?path={encodedPath}&includeHiddenElements=false", cts.Token);
|
||||
await _client.GetAsync($"/api/v1/path/check-path-exists?path={encodedPath}&shouldIncludeHiddenElements=false", cts.Token);
|
||||
});
|
||||
Assert.IsType<TaskCanceledException>(exception);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user