|
namespace UnitTests
{
#region Using directives.
// ----------------------------------------------------------------------
using System.Diagnostics;
using ActiveDirectoryHelper;
using NUnit.Framework;
// ----------------------------------------------------------------------
#endregion
/////////////////////////////////////////////////////////////////////////
[TestFixture]
public sealed class ActiveDirectoryTest
{
#region Set up and tear down.
// ------------------------------------------------------------------
[TestFixtureSetUp]
public void TestFixtureSetUp()
{
//...
}
[TestFixtureTearDown]
public void TestFixtureTearDown()
{
//...
}
[SetUp]
public void SetUp()
{
//...
}
[TearDown]
public void TearDown()
{
//...
}
// ------------------------------------------------------------------
#endregion
#region Tests.
// ------------------------------------------------------------------
[Test]
public void TestActiveDirectory()
{
var adc =
new ActiveDirectoryConfiguration
{
LdapServer = "MyServerNameOrIP",
LdapBaseDN = "dc=office, dc=my-domain, dc=com",
LdapUserName = "MYDOMAIN\\myuser",
LdapPassword = "mypassword"
};
var ad = new ActiveDirectory(adc);
// --
var allGroups = ad.GetGroupInfos();
var allUsers = ad.GetUserInfos();
if (allGroups != null)
{
foreach (var group in allGroups)
{
Trace.WriteLine(group.Name);
}
}
if (allUsers != null)
{
foreach (var user in allUsers)
{
Trace.WriteLine(user.Name);
}
}
}
// ------------------------------------------------------------------
#endregion
}
/////////////////////////////////////////////////////////////////////////
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.