public void op_GetObjectData_SerializationInfoNull_StreamingContext() { var context = new StreamingContext(StreamingContextStates.All); ISerializable value = new KeyStringPair(); // ReSharper disable AssignNullToNotNullAttribute Assert.Throws <ArgumentNullException>(() => value.GetObjectData(null, context)); // ReSharper restore AssignNullToNotNullAttribute }
public void op_GetObjectData_SerializationInfo_StreamingContext() { var info = new SerializationInfo(typeof(KeyStringPair), new FormatterConverter()); var context = new StreamingContext(StreamingContextStates.All); ISerializable value = new KeyStringPair("foo", "bar"); value.GetObjectData(info, context); Assert.Equal("foo", info.GetString("_key")); Assert.Equal("bar", info.GetString("_value")); }