Beispiel #1
0
        public void build_with_key_name_pair_in_ctor()
        {
            var values = new HttpHeaderValues(HttpResponseHeaders.Via, "something");

            values["Via"].ShouldBe("something");
            values.Headers.ShouldHaveTheSameElementsAs(new Header("Via", "something"));
        }
Beispiel #2
0
        public HttpHeaderValues Write(AssetPath path)
        {
            var files = _writer.Write(path);
            var etag  = _eTagGenerator.Create(files);

            _cache.LinkFilesToResource(path.ResourceHash, files);

            return(HttpHeaderValues.ForETag(etag));
        }
        protected override void beforeEach()
        {
            var headers1 = new HttpHeaderValues();

            headers1["a"] = "1";
            headers1["b"] = "2";

            var headers2 = new HttpHeaderValues();

            headers2["c"] = "3";
            headers2["d"] = "4";

            MockFor <IFubuRequest>().Stub(x => x.Find <IHaveHeaders>()).Return(new IHaveHeaders[] { headers1, headers2 });

            ClassUnderTest.WriteHeaders();
        }
        public void AddTest()
        {
            var header = new HttpHeaderValues();

            header.Add("Accept", "image/webp,image/apng,image/*,*/*");
            header.Add("Accept", "q=0.8");
            header.Add("Accept-Encoding", "gzip, deflate, br");
            header.Add("Accept-Language", "zh-CN,zh;q=0.9,en");
            header.Add("Accept-Language", "q=0.8");

            header.Add("Content-Type", "text/plain");
            header.Add("Content-Type", "charset=UTF-8");

            var header2 = new HttpHeaderValues("token", Guid.NewGuid().ToString("n"));

            header.Add(header2);

            var headerContent = header.ToString();
        }
        public void ToStringTest()
        {
            var header = new HttpHeaderValues();

            header.Add("Accept", "image/webp,image/apng,image/*,*/*");
            header.Add("Accept", "q=0.8");
            header.Add("Accept-Encoding", "gzip, deflate, br");
            header.Add("Accept-Language", "zh-CN,zh;q=0.9,en");
            header.Add("Accept-Language", "q=0.8");

            header.Add("Content-Type", "text/plain");
            header.Add("Content-Type", "charset=UTF-8");

            header.Add("Cookie", "BAIDUID=2A3EF7F2C89B57F81E4E2D4116BA4FAB:FG=1");
            header.Add("Cookie", "BIDUPSID=911317338F66E8EDF90E147D2EB08518");
            header.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36");

            var content = header.ToString();
        }
Beispiel #6
0
        protected override void beforeEach()
        {
            theEtag = "12345";

            theFiles = new AssetFile[] { new AssetFile("a"), new AssetFile("b") };

            theAssetPath = new AssetPath("scripts/something")
            {
                ResourceHash = Guid.NewGuid().ToString()
            };

            MockFor <IContentWriter>().Expect(x => x.Write(theAssetPath))
            .Return(theFiles);

            MockFor <IETagGenerator <IEnumerable <AssetFile> > >()
            .Stub(x => x.Create(theFiles))
            .Return(theEtag);

            theHeaders = ClassUnderTest.Write(theAssetPath);
        }