- Cleaned up whitespace in Directory.Build.props and Directory.Packages.props for consistency. - Reformatted project file references in PnvPanel.Api.csproj for better clarity. - Enhanced code readability in various endpoint files by adjusting line breaks and indentation. - Standardized method signatures and improved formatting in ResultExtensions and multiple endpoint classes for better maintainability.
57 lines
1.4 KiB
C#
57 lines
1.4 KiB
C#
using PnvPanel.Domain.Apps;
|
|
using Xunit;
|
|
|
|
namespace PnvPanel.Domain.Tests.Apps;
|
|
|
|
public class ClientAppTests
|
|
{
|
|
[Fact]
|
|
public void Create_SetsEnabledByDefault()
|
|
{
|
|
var app = ClientApp.Create(
|
|
"v2rayNG",
|
|
new Uri("https://play.google.com/store/apps/details?id=x"),
|
|
OsPlatform.Android,
|
|
"desc",
|
|
null,
|
|
1
|
|
);
|
|
|
|
Assert.Equal("v2rayNG", app.Name);
|
|
Assert.Equal(OsPlatform.Android, app.OperatingSystem);
|
|
Assert.True(app.IsEnabled);
|
|
Assert.Equal(1, app.SortOrder);
|
|
}
|
|
|
|
[Fact]
|
|
public void Update_ReplacesAllMutableFields()
|
|
{
|
|
var app = ClientApp.Create(
|
|
"Old",
|
|
new Uri("https://old.example.com"),
|
|
OsPlatform.IOS,
|
|
"old",
|
|
"old-icon",
|
|
1
|
|
);
|
|
|
|
app.Update(
|
|
"New",
|
|
new Uri("https://new.example.com"),
|
|
OsPlatform.MacOS,
|
|
"new",
|
|
"new-icon",
|
|
2,
|
|
isEnabled: false
|
|
);
|
|
|
|
Assert.Equal("New", app.Name);
|
|
Assert.Equal(new Uri("https://new.example.com"), app.DownloadUrl);
|
|
Assert.Equal(OsPlatform.MacOS, app.OperatingSystem);
|
|
Assert.Equal("new", app.Description);
|
|
Assert.Equal("new-icon", app.IconUrl);
|
|
Assert.Equal(2, app.SortOrder);
|
|
Assert.False(app.IsEnabled);
|
|
}
|
|
}
|