File: Model\ParameterValueHelpersTests.cs
Web Access
Project: src\tests\Aspire.Dashboard.Tests\Aspire.Dashboard.Tests.csproj (Aspire.Dashboard.Tests)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
 
using Aspire.Dashboard.Model;
using Aspire.DashboardService.Proto.V1;
using Xunit;
 
namespace Aspire.Dashboard.Tests.Model;
 
public class ParameterValueHelpersTests
{
    [Theory]
    [InlineData(InputType.File, """[{"Id":"0c7a2f1e","Name":"cert.pfx"},{"Id":"91be44d0","Name":"key.pem"}]""", "cert.pfx, key.pem")]
    [InlineData(InputType.File, "not-json", "not-json")]
    [InlineData(InputType.File, "[]", "[]")]
    [InlineData(InputType.File, "[null]", "[null]")]
    [InlineData(InputType.File, """[null,{"Id":"0c7a2f1e","Name":"cert.pfx"}]""", "cert.pfx")]
    [InlineData(InputType.Text, """[{"Id":"0c7a2f1e","Name":"cert.pfx"}]""", """[{"Id":"0c7a2f1e","Name":"cert.pfx"}]""")]
    public void GetDisplayValue_ShowsFileNamesForFileInputs(InputType inputType, string value, string expected)
    {
        Assert.Equal(expected, ParameterValueHelpers.GetDisplayValue(inputType, value));
    }
}