mirror of
https://github.com/FabInfra/S22.Sasl.git
synced 2025-03-12 23:01:49 +01:00
27 lines
810 B
C#
27 lines
810 B
C#
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|||
|
using S22.Sasl.Mechanisms;
|
|||
|
using System.Text;
|
|||
|
|
|||
|
namespace S22.Sasl.Test {
|
|||
|
/// <summary>
|
|||
|
/// Contains unit tests for the SASL PLAIN authentication mechanism.
|
|||
|
/// </summary>
|
|||
|
[TestClass]
|
|||
|
public class PlainTest {
|
|||
|
/// <summary>
|
|||
|
/// Verifies the various parts of a sample authentication exchange
|
|||
|
/// directly taken from RFC 4616 ("4. Examples", p. 5).
|
|||
|
/// </summary>
|
|||
|
[TestMethod]
|
|||
|
[TestCategory("Plain authentication")]
|
|||
|
public void VerfiyAuthenticationExchange() {
|
|||
|
SaslMechanism m = new SaslPlain("tim", "tanstaaftanstaaf");
|
|||
|
|
|||
|
string expectedResponse = "\0tim\0tanstaaftanstaaf";
|
|||
|
string initialResponse = Encoding.ASCII.GetString(
|
|||
|
m.GetResponse(new byte[0]));
|
|||
|
Assert.AreEqual<string>(expectedResponse, initialResponse);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|