Skip to content

Commit 906c026

Browse files
committed
PR feedback, missing serialization test
1 parent e694130 commit 906c026

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/Microsoft.ComponentDetection.Contracts.Tests/TypedComponentSerializationTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,16 @@ public void TypedComponent_Serialization_LinuxComponent()
204204
linuxComponent.Name.Should().Be("SomeLinuxComponentName");
205205
linuxComponent.Version.Should().Be("SomeLinuxComponentVersion");
206206
}
207+
208+
[TestMethod]
209+
public void TypedComponent_Serialization_CppSdk()
210+
{
211+
TypedComponent tc = new CppSdkComponent("SomeCppSdk", "1.2.3");
212+
var result = JsonSerializer.Serialize(tc);
213+
var deserializedTC = JsonSerializer.Deserialize<TypedComponent>(result);
214+
deserializedTC.Should().BeOfType(typeof(CppSdkComponent));
215+
var cppSdkComponent = (CppSdkComponent)deserializedTC;
216+
cppSdkComponent.Name.Should().Be("SomeCppSdk");
217+
cppSdkComponent.Version.Should().Be("1.2.3");
218+
}
207219
}

0 commit comments

Comments
 (0)