Exemplo n.º 1
0
        public void Header_IsPresent()
        {
            var        hh  = new MockHttpHelper("dummyuri");
            HttpHelper sut = hh;

            sut.AddHeader("name", "value");

            var s = hh.GetHeaderValue("name");

            Assert.Equal("value", s);
        }
Exemplo n.º 2
0
        public void Auth_Bearer_AddsCreds()
        {
            var        hh  = new MockHttpHelper("dummyuri");
            HttpHelper sut = hh;

            sut.AddBearerAuthHeader("secret");

            var s = hh.GetHeaderValue("Authorization");

            Assert.Contains("Bearer", s);
            Assert.Contains("secret", s);  // cant contain it in plain text.
        }
Exemplo n.º 3
0
        public void Auth_Basic_AddsB64Creds()
        {
            var        hh  = new MockHttpHelper("dummyuri");
            HttpHelper sut = hh;

            sut.AddBasicAuthHeader("secret");

            var s = hh.GetHeaderValue("Authorization");

            Assert.Contains("Basic", s);
            Assert.True(!s.Contains("secret"));  // cant contain it in plain text.
        }