@@ -15,45 +15,50 @@ namespace Aspire.Dashboard.Tests.Model;
1515
1616public class ResourceStateViewModelTests
1717{
18- private const string ResourceType = "Container" ;
19-
2018 [ Theory ]
2119 // Resource is no longer running
2220 [ InlineData (
23- /* state */ KnownResourceState . Exited , null , null , null ,
24- /* expected output */ $ "Localized:{ nameof ( Columns . StateColumnResourceExited ) } :{ ResourceType } ", "Warning" , Color . Warning , "Exited" ) ]
21+ /* state */ "Container" , KnownResourceState . Exited , null , null , null ,
22+ /* expected output */ $ "Localized:{ nameof ( Columns . StateColumnResourceExited ) } :Container", "RecordStop" , Color . Info , "Exited" ) ]
23+ [ InlineData (
24+ /* state */ "Container" , KnownResourceState . Exited , 3 , null , null ,
25+ /* expected output */ $ "Localized:{ nameof ( Columns . StateColumnResourceExitedUnexpectedly ) } :Container+3", "ErrorCircle" , Color . Error , "Exited" ) ]
26+ [ InlineData (
27+ /* state */ "Container" , KnownResourceState . Exited , 0 , null , null ,
28+ /* expected output */ $ "Localized:{ nameof ( Columns . StateColumnResourceExited ) } :Container", "RecordStop" , Color . Info , "Exited" ) ]
2529 [ InlineData (
26- /* state */ KnownResourceState . Exited , 3 , null , null ,
27- /* expected output */ $ "Localized:{ nameof ( Columns . StateColumnResourceExitedUnexpectedly ) } :{ ResourceType } +3 ", "ErrorCircle " , Color . Error , "Exited " ) ]
30+ /* state */ "Container" , KnownResourceState . Finished , 0 , null , null ,
31+ /* expected output */ $ "Localized:{ nameof ( Columns . StateColumnResourceExited ) } :Container ", "RecordStop " , Color . Info , "Finished " ) ]
2832 [ InlineData (
29- /* state */ KnownResourceState . Finished , 0 , null , null ,
30- /* expected output */ $ "Localized:{ nameof ( Columns . StateColumnResourceExited ) } :{ ResourceType } ", "RecordStop" , Color . Info , "Finished" ) ]
33+ /* state */ "CustomResource" , KnownResourceState . Finished , null , null , null ,
34+ /* expected output */ $ "Localized:{ nameof ( Columns . StateColumnResourceExited ) } :CustomResource ", "RecordStop" , Color . Info , "Finished" ) ]
3135 [ InlineData (
32- /* state */ KnownResourceState . Unknown , null , null , null ,
36+ /* state */ "Container" , KnownResourceState . Unknown , null , null , null ,
3337 /* expected output */ "Unknown" , "CircleHint" , Color . Info , "Unknown" ) ]
3438 // Health checks
3539 [ InlineData (
36- /* state */ KnownResourceState . Running , null , "Healthy" , null ,
40+ /* state */ "Container" , KnownResourceState . Running , null , "Healthy" , null ,
3741 /* expected output */ "Running" , "CheckmarkCircle" , Color . Success , "Running" ) ]
3842 [ InlineData (
39- /* state */ KnownResourceState . Running , null , "" , null ,
43+ /* state */ "Container" , KnownResourceState . Running , null , "" , null ,
4044 /* expected output */ $ "Localized:{ nameof ( Columns . RunningAndUnhealthyResourceStateToolTip ) } ", "CheckmarkCircleWarning" , Color . Warning , "Running (Unhealthy)" ) ]
4145 [ InlineData (
42- /* state */ KnownResourceState . Running , null , "Unhealthy" , null ,
46+ /* state */ "Container" , KnownResourceState . Running , null , "Unhealthy" , null ,
4347 /* expected output */ $ "Localized:{ nameof ( Columns . RunningAndUnhealthyResourceStateToolTip ) } ", "CheckmarkCircleWarning" , Color . Warning , "Running (Unhealthy)" ) ]
4448 [ InlineData (
45- /* state */ KnownResourceState . Running , null , "Healthy" , "warning" ,
49+ /* state */ "Container" , KnownResourceState . Running , null , "Healthy" , "warning" ,
4650 /* expected output */ "Running" , "Warning" , Color . Warning , "Running" ) ]
4751 [ InlineData (
48- /* state */ KnownResourceState . Running , null , "Healthy" , "NOT_A_VALID_STATE_STYLE" ,
52+ /* state */ "Container" , KnownResourceState . Running , null , "Healthy" , "NOT_A_VALID_STATE_STYLE" ,
4953 /* expected output */ "Running" , "Circle" , Color . Neutral , "Running" ) ]
5054 [ InlineData (
51- /* state */ KnownResourceState . Running , null , null , "info" ,
55+ /* state */ "Container" , KnownResourceState . Running , null , null , "info" ,
5256 /* expected output */ "Running" , "Info" , Color . Info , "Running" ) ]
5357 [ InlineData (
54- /* state */ KnownResourceState . RuntimeUnhealthy , null , null , null ,
58+ /* state */ "Container" , KnownResourceState . RuntimeUnhealthy , null , null , null ,
5559 /* expected output */ $ "Localized:{ nameof ( Columns . StateColumnResourceContainerRuntimeUnhealthy ) } ", "Warning" , Color . Warning , "Runtime unhealthy" ) ]
5660 public void ResourceViewModel_ReturnsCorrectIconAndTooltip (
61+ string resourceType ,
5762 KnownResourceState state ,
5863 int ? exitCode ,
5964 string ? healthStatusString ,
@@ -76,7 +81,7 @@ public void ResourceViewModel_ReturnsCorrectIconAndTooltip(
7681 reportHealthStatus : healthStatus ,
7782 createNullHealthReport : healthStatusString == "" ,
7883 stateStyle : stateStyle ,
79- resourceType : ResourceType ,
84+ resourceType : resourceType ,
8085 properties : propertiesDictionary ) ;
8186
8287 if ( exitCode is not null )
0 commit comments