Make() public method

Let the factory maken a new mecahnism by its name
public Make ( string mechanism ) : ASaslMechanism
mechanism string Sasl mechanism name to make
return TripleSoftware.Sasl.Mechanism.ASaslMechanism
示例#1
0
		public void testSaslFactory(){
			SaslFactory saslFactory = new SaslFactory();
			ISaslMechanism mechanism = saslFactory.Make( "digest-md5" );
			mechanism.Password = password;
			mechanism.UserName = username;
			mechanism.Server = server;
			mechanism.Protocol = "xmpp";
			mechanism.Challenge = challenge;
			Assert.AreEqual(response, mechanism.GetResponse());
		}
示例#2
0
		public void testErrorSaslFactory(){
			bool fail = false;
			SaslFactory saslFactory = new SaslFactory();
			try{
				ISaslMechanism mechanism = saslFactory.Make( "md5" );
				mechanism.Password = password;
				mechanism.UserName = username;
				mechanism.Server = server;
				mechanism.Challenge = challenge;
				Assert.AreEqual(response, mechanism.GetResponse());
			} catch( SaslMechanismNotAvailableException){
				fail = true;
			}
			
			Assert.IsTrue( fail );
		}