示例#1
0
        public void CanCreateExceptionWithInnerException()
        {
            var inner = new AcmeException();
            var ex    = new AcmeRequestException("certes", inner);

            Assert.Equal("certes", ex.Message);
            Assert.Equal(inner, ex.InnerException);
        }
示例#2
0
        public void CanSerialize()
        {
            var ex = new AcmeRequestException("certes");

            var serializer = new BinaryFormatter();

            using (var buffer = new MemoryStream())
            {
                serializer.Serialize(buffer, ex);

                buffer.Seek(0, SeekOrigin.Begin);
                var deserialized = (AcmeRequestException)serializer.Deserialize(buffer);

                Assert.Equal("certes", deserialized.Message);
            }
        }
示例#3
0
        public void CanSerializeWithError()
        {
            var error = new AcmeError {
                Detail = "error"
            };
            var ex = new AcmeRequestException("certes", error);

            var serializer = new BinaryFormatter();

            using (var buffer = new MemoryStream())
            {
                serializer.Serialize(buffer, ex);

                buffer.Seek(0, SeekOrigin.Begin);
                var deserialized = (AcmeRequestException)serializer.Deserialize(buffer);

                Assert.NotNull(deserialized.Error.Detail);
                Assert.Equal("error", deserialized.Error.Detail);
            }
        }
示例#4
0
        public void CanCreateExceptionWithMessage()
        {
            var ex = new AcmeRequestException("certes");

            Assert.Equal("certes", ex.Message);
        }
示例#5
0
 public void CanCreateException()
 {
     var ex = new AcmeRequestException();
 }