コード例 #1
0
 public void ShouldSetHttpStatusCodeAndMessage()
 {
     HttpStatusCode statusCode = HttpStatusCode.InternalServerError;
     const string message = "error message";
     AdapterException exception = new AdapterException(statusCode, message);
     Assert.AreEqual(statusCode, exception.StatusCode, "The status code was not set.");
     Assert.AreEqual(message, exception.Message, "The message was not set.");
 }
コード例 #2
0
        public void ShouldSetHttpStatusCodeAndMessage()
        {
            HttpStatusCode   statusCode = HttpStatusCode.InternalServerError;
            const string     message    = "error message";
            AdapterException exception  = new AdapterException(statusCode, message);

            Assert.AreEqual(statusCode, exception.StatusCode, "The status code was not set.");
            Assert.AreEqual(message, exception.Message, "The message was not set.");
        }
コード例 #3
0
        public void ShouldBeSerializable()
        {
            Exception innerException = new Exception("inner exception message");
            AdapterException exception = new AdapterException(HttpStatusCode.InternalServerError, "exception message", innerException);

            SerializationHelper helper = new SerializationHelper();
            AdapterException deserialized = helper.Roundtrip(exception);

            Assert.AreEqual(exception.StatusCode, deserialized.StatusCode, "The status code was not serialized.");
            Assert.AreEqual(exception.Message, deserialized.Message, "The message was not serialized.");
            Assert.AreEqual(innerException.Message, deserialized.InnerException.Message, "The inner exception was not serialized.");
        }
コード例 #4
0
        public void ShouldBeSerializable()
        {
            Exception        innerException = new Exception("inner exception message");
            AdapterException exception      = new AdapterException(HttpStatusCode.InternalServerError, "exception message", innerException);

            SerializationHelper helper       = new SerializationHelper();
            AdapterException    deserialized = helper.Roundtrip(exception);

            Assert.AreEqual(exception.StatusCode, deserialized.StatusCode, "The status code was not serialized.");
            Assert.AreEqual(exception.Message, deserialized.Message, "The message was not serialized.");
            Assert.AreEqual(innerException.Message, deserialized.InnerException.Message, "The inner exception was not serialized.");
        }
コード例 #5
0
 public void ShouldSetHttpStatusCode()
 {
     AdapterException exception = new AdapterException(HttpStatusCode.InternalServerError);
     Assert.AreEqual(HttpStatusCode.InternalServerError, exception.StatusCode, "The status code was not set.");
 }
コード例 #6
0
        public void ShouldSetHttpStatusCode()
        {
            AdapterException exception = new AdapterException(HttpStatusCode.InternalServerError);

            Assert.AreEqual(HttpStatusCode.InternalServerError, exception.StatusCode, "The status code was not set.");
        }