Пример #1
0
        public void CodeDomSerializerException_Constructor_SerializationManager()
        {
            _mockDesignerSerializationManager = new Mock <IDesignerSerializationManager>(MockBehavior.Strict);
            var underTest = new CodeDomSerializerException("message", _mockDesignerSerializationManager.Object);

            Assert.NotNull(underTest);
        }
Пример #2
0
        public void CodeDomSerializerException_Constructor_Message_Pragma()
        {
            var pragma    = new CodeLinePragma();
            var underTest = new CodeDomSerializerException("message", pragma);

            Assert.NotNull(underTest);
            Assert.Equal(pragma, underTest.LinePragma);
        }
        public void CodeDomSerializerException_Ctor_String_IDesignerSerializationManager(string message, IDesignerSerializationManager manager)
        {
            var exception = new CodeDomSerializerException(message, manager);

            Assert.NotEmpty(exception.Message);
            Assert.Null(exception.InnerException);
            Assert.Null(exception.LinePragma);
        }
        public void CodeDomSerializerException_Ctor_Exception_IDesignerSerializationManager(Exception innerException, IDesignerSerializationManager manager)
        {
            var exception = new CodeDomSerializerException(innerException, manager);

            Assert.NotEmpty(exception.Message);
            Assert.Same(innerException, exception.InnerException);
            Assert.Null(exception.LinePragma);
        }
        public void CodeDomSerializerException_Ctor_String_CodeLinePragma(string message, CodeLinePragma linePragma)
        {
            var exception = new CodeDomSerializerException(message, linePragma);

            Assert.NotEmpty(exception.Message);
            Assert.Null(exception.InnerException);
            Assert.Same(linePragma, exception.LinePragma);
        }
        public void CodeDomSerializerException_Ctor_Exception_CodeLinePragma(Exception innerException, CodeLinePragma linePragma)
        {
            var exception = new CodeDomSerializerException(innerException, linePragma);

            Assert.NotEmpty(exception.Message);
            Assert.Same(innerException, exception.InnerException);
            Assert.Same(linePragma, exception.LinePragma);
        }
 public void CodeDomSerializerException_Serialize_ThrowsSerializationException()
 {
     using (var stream = new MemoryStream())
     {
         var formatter = new BinaryFormatter();
         var exception = new CodeDomSerializerException("message", new CodeLinePragma("fileName.cs", 11));
         Assert.Throws <SerializationException>(() => formatter.Serialize(stream, exception));
     }
 }
        public void CodeDomSerializerException_Serialize_ThrowsSerializationException()
        {
            using (var stream = new MemoryStream())
            {
                var formatter = new BinaryFormatter();
                var exception = new CodeDomSerializerException("message", new CodeLinePragma("fileName.cs", 11));
#pragma warning disable SYSLIB0011 // Type or member is obsolete
                Assert.Throws <SerializationException>(() => formatter.Serialize(stream, exception));
#pragma warning restore SYSLIB0011 // Type or member is obsolete
            }
        }
Пример #9
0
        public void CodeDomSerializerException_SerializeWithoutPragma_Deserialize_Success()
        {
            using (var stream = new MemoryStream())
            {
                var formatter = new BinaryFormatter();
                var exception = new CodeDomSerializerException("message", (CodeLinePragma)null);
                formatter.Serialize(stream, exception);

                stream.Position = 0;
                CodeDomSerializerException deserialized = Assert.IsType <CodeDomSerializerException>(formatter.Deserialize(stream));
                Assert.Equal(exception.Message, deserialized.Message);
                Assert.Null(deserialized.LinePragma);
            }
        }
        public void CodeDomSerializerException_GetObjectData_ThrowsPlatformNotSupportedException()
        {
            var exception = new CodeDomSerializerException("message", new CodeLinePragma("fileName.cs", 11));

            Assert.Throws <PlatformNotSupportedException>(() => exception.GetObjectData(null, new StreamingContext()));
        }
Пример #11
0
        public void CodeDomSerializerException_GetObjectData_NullInfo_ThrowsArgumentNullException()
        {
            var exception = new CodeDomSerializerException("message", new CodeLinePragma());

            Assert.Throws <ArgumentNullException>("info", () => exception.GetObjectData(null, new StreamingContext()));
        }