public void When_cipheroptsommitted_should_contian_none()
 {
     const string challange = "realm=\"somerealm\",nonce=\"somenonce\",qop=\"auth\",charset=utf-8,algorithm=md5-sess";
     var digestChallenge = new DigestMD5Challenge(challange);
     Assert.Null(digestChallenge.CipherOptions);
 }
 public void When_charset_ommitted_should_default()
 {
     const string challange = "realm=\"somerealm\",nonce=\"somenonce\",qop=\"auth-int\",algorithm=md5-sess";
     var digestChallenge = new DigestMD5Challenge(challange);
     Assert.Equal("iso-8859-1", digestChallenge.CharacterSet.WebName);
 }
 public void When_charset_supplied_should_contain_value()
 {
     const string challange = "realm=\"somerealm\",nonce=\"somenonce\",qop=\"auth-int\",charset=utf-8,algorithm=md5-sess";
     var digestChallenge = new DigestMD5Challenge(challange);
     Assert.Equal("utf-8", digestChallenge.CharacterSet.WebName);
 }
 public void When_two_realm_are_supplied_should_contain_both()
 {
     const string challange = "realm=\"somerealm1\",realm=\"somerealm2\",nonce=\"somenonce\",qop=\"auth\",charset=utf-8,algorithm=md5-sess";
     var digestChallenge = new DigestMD5Challenge(challange);
     Assert.Equal(2, digestChallenge.Realms.Count());
     Assert.Contains("somerealm1", digestChallenge.Realms.ToList());
     Assert.Contains("somerealm2", digestChallenge.Realms.ToList());
 }
 public void When_algorithm_supplied_should_contain_value()
 {
     const string challange = "realm=\"somerealm\",nonce=\"somenonce\",qop=\"auth\",charset=utf-8,algorithm=md5-sess";
     var digestChallenge = new DigestMD5Challenge(challange);
     Assert.Equal("md5-sess", digestChallenge.Algorithm);
 }
 public void When_two_qop_supplied_should_contain_both()
 {
     const string challange = "realm=\"somerealm\",nonce=\"somenonce\",qop=\"auth-int\",qop=\"auth-conf\",charset=utf-8,algorithm=md5-sess,cipher=\"3des\"";
     var digestChallenge = new DigestMD5Challenge(challange);
     Assert.Contains("auth-int", digestChallenge.QopOptions.ToList());
     Assert.Contains("auth-conf", digestChallenge.QopOptions.ToList());
 }
 public void When_a_realm_is_supplied_twice_should_contain_value_once()
 {
     const string challange = "realm=\"somerealm\",realm=\"somerealm\",nonce=\"somenonce\",qop=\"auth\",charset=utf-8,algorithm=md5-sess";
     var digestChallenge = new DigestMD5Challenge(challange);
     Assert.Equal(1, digestChallenge.Realms.Count());
 }
 public void When_no_qopoption_supplied_should_default_to_Auth()
 {
     const string challange = "realm=\"somerealm\",nonce=\"somenonce\",charset=utf-8,algorithm=md5-sess";
     var digestChallenge = new DigestMD5Challenge(challange);
     Assert.Contains("auth", digestChallenge.QopOptions.ToList());
 }
 public void When_maxbuf_supplied_should_contain_value()
 {
     const string challange = "realm=\"somerealm\",nonce=\"somenonce\",qop=\"auth-int\",maxbuf=10000,charset=utf-8,algorithm=md5-sess";
     var digestChallenge = new DigestMD5Challenge(challange);
     Assert.Equal(10000, digestChallenge.MaximumBufferSize);
 }
 public void When_maxbuf_ommitted_should_default_to_65536()
 {
     const string challange = "realm=\"somerealm\",nonce=\"somenonce\",qop=\"auth-int\",charset=utf-8,algorithm=md5-sess";
     var digestChallenge = new DigestMD5Challenge(challange);
     Assert.Equal(65536, digestChallenge.MaximumBufferSize);
 }
 public void When_cipheropts_supplied_should_contain_value()
 {
     const string challange = "realm=\"somerealm\",nonce=\"somenonce\",qop=\"auth\",charset=utf-8,algorithm=md5-sess,cipher=\"3des\"";
     var digestChallenge = new DigestMD5Challenge(challange);
     Assert.NotNull(digestChallenge.CipherOptions);
     Assert.Equal(1, digestChallenge.CipherOptions.Count());
     Assert.Contains("3des", digestChallenge.CipherOptions.ToList());
 }
 public DigestMD5Authentication(string challenge)
 {
     digestChallenge = new DigestMD5Challenge(challenge);
 }