feat(11-04): add UpdateProfileAsync to ProfileService and ImportLogoFromBytesAsync to BrandingService
- ProfileService.UpdateProfileAsync: replaces profile by name and persists the change - IBrandingService: add ImportLogoFromBytesAsync to interface contract - BrandingService.ImportLogoFromBytesAsync: validates magic bytes, compresses if > 512KB, returns LogoData - BrandingService.ImportLogoAsync: refactored to delegate to ImportLogoFromBytesAsync - ProfileServiceTests: 2 new tests (UpdateProfileAsync happy path + KeyNotFoundException) - BrandingServiceTests: 2 new tests (ImportLogoFromBytesAsync valid PNG + invalid bytes) - Tests.csproj: suppress NU1701 for pre-existing LiveCharts2/OpenTK transitive warnings
This commit is contained in:
@@ -220,4 +220,25 @@ public class BrandingServiceTests : IDisposable
|
||||
|
||||
Assert.Null(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ImportLogoFromBytesAsync_ValidPngBytes_ReturnsPngLogoData()
|
||||
{
|
||||
var service = CreateService();
|
||||
var pngBytes = MinimalPngBytes();
|
||||
|
||||
var result = await service.ImportLogoFromBytesAsync(pngBytes);
|
||||
|
||||
Assert.Equal("image/png", result.MimeType);
|
||||
Assert.Equal(Convert.ToBase64String(pngBytes), result.Base64);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ImportLogoFromBytesAsync_InvalidBytes_ThrowsInvalidDataException()
|
||||
{
|
||||
var service = CreateService();
|
||||
var invalidBytes = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
|
||||
|
||||
await Assert.ThrowsAsync<InvalidDataException>(() => service.ImportLogoFromBytesAsync(invalidBytes));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user