System.Net.Http.Tests.AuthenticationHeaderValueTest.Ctor_SetBothSchemeAndParameters_MatchExpectation C# (CSharp) Method

Ctor_SetBothSchemeAndParameters_MatchExpectation() private method

private Ctor_SetBothSchemeAndParameters_MatchExpectation ( ) : void
return void
        public void Ctor_SetBothSchemeAndParameters_MatchExpectation()
        {
            AuthenticationHeaderValue auth = new AuthenticationHeaderValue("Basic", "realm=\"contoso.com\"");
            Assert.Equal("Basic", auth.Scheme);
            Assert.Equal("realm=\"contoso.com\"", auth.Parameter);

            Assert.Throws<ArgumentException>(() => { new AuthenticationHeaderValue(null, "x"); });
            Assert.Throws<ArgumentException>(() => { new AuthenticationHeaderValue("", "x"); });
            Assert.Throws<FormatException>(() => { new AuthenticationHeaderValue(" x", "x"); });
            Assert.Throws<FormatException>(() => { new AuthenticationHeaderValue("x ", "x"); });
            Assert.Throws<FormatException>(() => { new AuthenticationHeaderValue("x y", "x"); });
        }