public void op_GetObjectData_SerializationInfoNull_StreamingContext() { var context = new StreamingContext(StreamingContextStates.All); ISerializable value = new Quality(0.852f); // ReSharper disable AssignNullToNotNullAttribute Assert.Throws <ArgumentNullException>(() => value.GetObjectData(null, context)); // ReSharper restore AssignNullToNotNullAttribute }
public void op_GetObjectData_SerializationInfo_StreamingContext() { var info = new SerializationInfo(typeof(Quality), new FormatterConverter()); var context = new StreamingContext(StreamingContextStates.All); const string expected = "0.468"; ISerializable value = new Quality(0.468f); value.GetObjectData(info, context); var actual = info.GetString("_value"); Assert.Equal(expected, actual); }