public void Should_Throw_ArgumentNullException_If_SerializationInfo_Is_Null() { // Arrange & Act var exception = Record.Exception(() => MaybeUtils.SetData <BaseClass>(null, "key", new BaseClass())); // Assert exception.ShouldBeOfType <ArgumentNullException>(); }
public void Should_Add_Value_To_SerializationInfo() { // Arrange var baseClass = new BaseClass(); var key = "key"; var serializationInfo = new SerializationInfo(typeof(BaseClass), new FormatterConverter()); // Act MaybeUtils.SetData <BaseClass>(serializationInfo, key, baseClass); // Assert var value = serializationInfo.GetValue(key, typeof(BaseClass)); value.ShouldBe(baseClass); }