コード例 #1
0
ファイル: Quarter.Facts.cs プロジェクト: KarlDirck/cavity
        public void op_GetObjectData_SerializationInfo_StreamingContext()
        {
            var info = new SerializationInfo(typeof(Quarter), new FormatterConverter());
            var context = new StreamingContext(StreamingContextStates.All);

            const string expected = "10/01/1999 00:00:00";

            ISerializable value = new Quarter(1999, 4);

            value.GetObjectData(info, context);

            var actual = info.GetString("_value");

            Assert.Equal(expected, actual);
        }
コード例 #2
0
ファイル: Quarter.Facts.cs プロジェクト: KarlDirck/cavity
        public void op_GetObjectData_SerializationInfoNull_StreamingContext()
        {
            var context = new StreamingContext(StreamingContextStates.All);

            ISerializable value = new Quarter(1999, 3);

            // ReSharper disable AssignNullToNotNullAttribute
            Assert.Throws<ArgumentNullException>(() => value.GetObjectData(null, context));

            // ReSharper restore AssignNullToNotNullAttribute
        }