aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2025-04-07 12:33:22 -0500
committerJP Dillingham <jp@dillingham.me>2025-04-07 12:33:22 -0500
commit21da11dfae33529d2672da06a8fa52b5343b5239 (patch)
tree3de39aea286ccb9cc350307817b30e3981f3bbf6 /tests
parent831e9ce49abbcc64a7b75c6fb2c90ad20b233e00 (diff)
downloadslskd-21da11dfae33529d2672da06a8fa52b5343b5239.tar.gz
simplify fetch of picture bytes
Diffstat (limited to 'tests')
-rw-r--r--tests/slskd.Tests.Unit/Users/UserServiceTests.cs56
1 files changed, 1 insertions, 55 deletions
diff --git a/tests/slskd.Tests.Unit/Users/UserServiceTests.cs b/tests/slskd.Tests.Unit/Users/UserServiceTests.cs
index 205ff0e2..8581a966 100644
--- a/tests/slskd.Tests.Unit/Users/UserServiceTests.cs
+++ b/tests/slskd.Tests.Unit/Users/UserServiceTests.cs
@@ -121,66 +121,12 @@
}
}
- public class GetProfilePicture
- {
- [Theory]
- [InlineData(null)]
- [InlineData("")]
- [InlineData(" ")]
- public void Returns_Null_When_Path_Is_NullOrWhitespace(string path)
- {
- var (service, _) = GetFixture();
-
- var result = service.GetProfilePicture(path);
-
- Assert.Null(result);
- }
-
- [Fact]
- public void Returns_Null_When_File_Does_Not_Exist()
- {
- const string nonExistentPath = "nonexistent-file.jpg";
- var (service, _) = GetFixture();
-
- var result = service.GetProfilePicture(nonExistentPath);
-
- Assert.Null(result);
- }
-
- [Fact]
- public void Returns_File_Bytes_When_File_Exists()
- {
- var tempFile = Path.GetTempFileName();
- try
- {
- // Write some test data to the temp file
- System.IO.File.WriteAllBytes(tempFile, new byte[] { 1, 2, 3, 4, 5 });
-
- var (service, _) = GetFixture();
-
- var result = service.GetProfilePicture(tempFile);
-
- Assert.NotNull(result);
- Assert.Equal(new byte[] { 1, 2, 3, 4, 5 }, result);
- }
- finally
- {
- // Clean up
- if (System.IO.File.Exists(tempFile))
- {
- System.IO.File.Delete(tempFile);
- }
- }
- }
- }
-
private static (UserService service, Mocks mocks) GetFixture(Options options = null)
{
var mocks = new Mocks(options);
var service = new UserService(
mocks.SoulseekClient.Object,
- mocks.OptionsMonitor,
- mocks.FileService);
+ mocks.OptionsMonitor);
return (service, mocks);
}