Example #1
0
        public void Get(string url)
        {
            if (!url.StartsWith("/cassette.axd"))
            {
                throw new ArgumentException("Must be a Cassette handler URL.", "url");
            }

            if (url.Contains("?"))
            {
                url = url.Substring(0, url.IndexOf('?'));
            }

            var pathInfo = url.Substring("/cassette.axd".Length);

            Request.SetupGet(r => r.RequestType).Returns("GET");
            Request.SetupGet(r => r.HttpMethod).Returns("GET");
            Request.SetupGet(r => r.AppRelativeCurrentExecutionFilePath).Returns("~/cassette.axd");
            Request.SetupGet(r => r.PathInfo).Returns(pathInfo);

            host.StoreRequestContainerInHttpContextItems();
            var httpHandler = new CassetteHttpHandler(host.RequestContainer, Request.Object);

            httpHandler.ProcessRequest();
            ResponseOutputStream.Position = 0;
            host.RemoveRequestContainerFromHttpContextItems();
        }