public void ProcessRequest_PaperclipIsUrl()
        {
            // arrange
            var handler = new PaperClipHandler();
            var context = Mock.Create<HttpContext>(Behavior.CallOriginal);

            Mock.Arrange(() => context.Request.QueryString[Constants.FileProcessFileName]).Returns("http://www.qad.com/Public/Images/QAD_2009/qad_Logo_forBanner.gif");
            Mock.Arrange(() => context.Request.QueryString["Location"]).Returns("Hyperlink");

            Mock.Arrange(() => context.Response.Redirect("http://www.qad.com/Public/Images/QAD_2009/qad_Logo_forBanner.gif")).OccursOnce();

            // act
            handler.ProcessRequest(context);

            // assert
            Mock.Assert(context);

            // arrange
            Mock.Arrange(() => context.Request.QueryString[Constants.FileProcessFileName]).Returns("www.google.com");
            Mock.Arrange(() => context.Response.Redirect("http://www.google.com/")).OccursOnce();

            // act
            handler.ProcessRequest(context);

            // assert
            Mock.Assert(context);
        }
        public void ProcessRequest_FileNameIsNull()
        {
            // arrange
            var handler = new PaperClipHandler();
            var context = Mock.Create<HttpContext>(Behavior.CallOriginal);

            Mock.Arrange(() => context.Request.QueryString[Constants.FileProcessFileName]).Returns((string)null);
            Mock.Arrange(() => context.Request.QueryString["Location"]).Throws<Exception>();

            try
            {
                // act
                handler.ProcessRequest(context);
            }
            catch (Exception ex)
            {
                // assert
                Assert.Fail("Expected no exception, but got: " + ex.Message);
            }

            // arrange
            Mock.Arrange(() => context.Request.QueryString[Constants.FileProcessFileName]).Returns(string.Empty);

            try
            {
                // act
                handler.ProcessRequest(context);
            }
            catch (Exception ex)
            {
                // assert
                Assert.Fail("Expected no exception, but got: " + ex.Message);
            }
        }