Пример #1
0
        public void TestInitialize()
        {
            using (var client = new NTLMMechanism()) {
            client.Credential = new NetworkCredential("user", "pass", "DOMAIN");
            client.TargetHost = "WORKSTATION";

            Assert.AreEqual(SaslExchangeStatus.None, client.ExchangeStatus);

            byte[] initialResponseFirst;

            Assert.AreEqual(SaslExchangeStatus.Continuing,
                        client.GetInitialResponse(out initialResponseFirst));
            Assert.AreEqual(SaslExchangeStatus.Continuing, client.ExchangeStatus);

            client.Initialize();

            Assert.AreEqual(SaslExchangeStatus.None, client.ExchangeStatus);

            byte[] initialResponseSecond;

            Assert.AreEqual(SaslExchangeStatus.Continuing,
                        client.GetInitialResponse(out initialResponseSecond));
            Assert.AreEqual(SaslExchangeStatus.Continuing, client.ExchangeStatus);

            Assert.AreEqual(initialResponseFirst, initialResponseSecond);
              }
        }
Пример #2
0
        public void TestGetInitialResponse()
        {
            using (var client = new NTLMMechanism()) {
            Assert.AreEqual(SaslExchangeStatus.None, client.ExchangeStatus);

            Assert.IsTrue(client.ClientFirst);

            client.Credential = new NetworkCredential("user", "pass", "DOMAIN");
            client.TargetHost = "WORKSTATION";

            byte[] initialResponse;

            Assert.AreEqual(SaslExchangeStatus.Continuing,
                        client.GetInitialResponse(out initialResponse));
            Assert.AreEqual(SaslExchangeStatus.Continuing, client.ExchangeStatus);
              }
        }