public void WhenParamNameAndMessageSpecified_ThenSetMessageAndParamName()
        {
            var sut = new ArgumentNullOrEmptyException(ParamName, Message);

            Assert.That(sut.Message, Is.EqualTo($"{Message} (Parameter 'myArg')"));
            Assert.That(sut.ParamName, Is.EqualTo(ParamName));
        }
        public void WhenParamNameSpecified_ThenSetMessageAndParamName()
        {
            var sut = new ArgumentNullOrEmptyException(ParamName);

            Assert.That(sut.Message, Is.EqualTo("Value cannot be null or empty. (Parameter 'myArg')"));
            Assert.That(sut.ParamName, Is.EqualTo(ParamName));
        }
        public void WhenSerialized_ThenDeserializeCorrectly()
        {
            var sut = new ArgumentNullOrEmptyException(ParamName, Message);

            var result = Serializer.SerializeAndDeserialize(sut);

            Assert.That(result.ParamName, Is.EqualTo(sut.ParamName));
            Assert.That(result.ToString(), Is.EqualTo(sut.ToString()));
        }
        public void WhenMessageAndInnerExSpecified_ThenSetMessageAndInnerEx()
        {
            var innerException = new Exception();

            var sut = new ArgumentNullOrEmptyException(Message, innerException);

            Assert.That(sut.Message, Is.EqualTo(Message));
            Assert.That(sut.InnerException, Is.SameAs(innerException));
        }
        /// <summary>
        /// Initialize new CaterpillarHttpRequestBase instance.
        /// </summary>
        /// <param name="requestContext">RequestContext object which has information about an HTTP request that matches a defined route.</param>
        /// <exception cref="">Throws argument null exception, if <paramref name="requestContext"/> is null.</exception>
        public CaterpillarHttpRequestBase(RequestContext requestContext)
        {
            if (requestContext == null)
            {
                ArgumentNullOrEmptyException.Throw("requestContext");
            }

            this.Request        = this.RequestContext.HttpContext.Request;
            this.RequestContext = requestContext;
        }
        public CaterpillarHttpRequestBase(HttpRequestBase httpRequest)
        {
            if (httpRequest == null)
            {
                ArgumentNullOrEmptyException.Throw("httpRequest");
            }

            this.Request        = httpRequest;
            this.RequestContext = this.Request.RequestContext;
        }
        public void WhenNoArgs_ThenSetMessageToDefault()
        {
            var sut = new ArgumentNullOrEmptyException();

            Assert.That(sut.Message, Is.EqualTo("Value cannot be null or empty."));
        }