Skip to content

Commit

Permalink
adding missed validation and new test so it dont happen again"
Browse files Browse the repository at this point in the history
Signed-off-by: Neil South <[email protected]>
  • Loading branch information
neildsouth committed Dec 14, 2023
1 parent e51383b commit be83f33
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Messaging/Common/ArtifactTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static class ArtifactTypes
{
{ ArtifactType.Unset, "Unset" },
{ ArtifactType.Folder, "Folders" },
{ ArtifactType.HL7, "HL7 message" },
{ ArtifactType.AR, "Autorefract" },
{ ArtifactType.ASMT, "Content Assessment Results" },
{ ArtifactType.AU, "Audio" },
Expand Down
17 changes: 17 additions & 0 deletions src/Messaging/Tests/Common/ArtifactTypesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

using System;
using Monai.Deploy.Messaging.Common;
using Xunit;

Expand All @@ -32,5 +33,21 @@ public void ArtifactTypeInvalid_ShouldReturnFalse()
{
Assert.False(ArtifactTypes.Validate("false"));
}

[Fact]
public void ArtifactTypeNull_ShouldReturnFalse()
{
Assert.False(ArtifactTypes.Validate(null));

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / analyze (csharp)

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / analyze (csharp)

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / unit-test

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Cannot convert null literal to non-nullable reference type.
}

[Fact]
public void ArtifactTypes_Should_Contain_All()
{
foreach (var artifactType in Enum.GetValues(typeof(ArtifactType)))
{
Assert.True(ArtifactTypes.ListOfModularity.ContainsKey((ArtifactType)artifactType));
}
}

}
}

0 comments on commit be83f33

Please sign in to comment.