Premiere commit - Omika
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
using Omika.App.Services;
|
||||
|
||||
namespace Omika.Tests.Mobile.Local;
|
||||
|
||||
/// <summary>
|
||||
/// Tests du PlatformDeviceIdProvider : génération d'un identifiant unique et
|
||||
/// stable entre les lancements. Ne contient aucune donnée personnelle.
|
||||
/// </summary>
|
||||
public class PlatformDeviceIdProviderTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task GetDeviceId_RetourneIdentifiantNonVide()
|
||||
{
|
||||
// Arrange
|
||||
var provider = new PlatformDeviceIdProvider();
|
||||
|
||||
// Act
|
||||
string deviceId = await provider.GetDeviceIdAsync();
|
||||
|
||||
// Assert
|
||||
Assert.False(string.IsNullOrWhiteSpace(deviceId));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetDeviceId_StableEntreAppels()
|
||||
{
|
||||
// Arrange
|
||||
var provider = new PlatformDeviceIdProvider();
|
||||
|
||||
// Act
|
||||
string first = await provider.GetDeviceIdAsync();
|
||||
string second = await provider.GetDeviceIdAsync();
|
||||
|
||||
// Assert : l'identifiant est stable.
|
||||
Assert.Equal(first, second);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetDeviceId_FormatGuid()
|
||||
{
|
||||
// Arrange
|
||||
var provider = new PlatformDeviceIdProvider();
|
||||
|
||||
// Act
|
||||
string deviceId = await provider.GetDeviceIdAsync();
|
||||
|
||||
// Assert : l'identifiant est un GUID (32 hex sans tirets).
|
||||
Assert.Equal(32, deviceId.Length);
|
||||
Assert.True(Guid.TryParseExact(deviceId, "N", out _));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user