public void SpecialCharacters() { DN dn = new DN(@"CN=\#Pound\,Comma\=Equals Sign\+Plus sign\<Less than\>Greater than\;Semicolon\\Backslash\""Quote", EscapeChars.SpecialChars); Assert.AreEqual(dn.ToString(), @"CN=\#Pound\,Comma\=Equals Sign\+Plus sign\<Less than\>Greater than\;Semicolon\\Backslash\""Quote"); dn.CharsToEscape = EscapeChars.None; Assert.AreEqual(dn.ToString(), @"CN=#Pound,Comma=Equals Sign+Plus sign<Less than>Greater than;Semicolon\Backslash""Quote"); }
public void SpacesAtBeginningAndEnd() { DN dn = new DN(@"CN=\ Pete \ ", EscapeChars.SpecialChars); Assert.AreEqual(dn.ToString(), @"CN=\ Pete \ "); dn.CharsToEscape = EscapeChars.None; Assert.AreEqual(dn.ToString(), @"CN= Pete "); }
public void SpecialCharacters() { DN dn = new DN(@"CN=\#Pound\,Comma\=Equals Sign\+Plus sign\<Less than\>Greater than\;Semicolon\\Backslash\""Quote", EscapeChars.SpecialChars); Assert.AreEqual(dn.ToString(), @"CN=\#Pound\,Comma\=Equals Sign\+Plus sign\<Less than\>Greater than\;Semicolon\\Backslash\""Quote"); dn.CharsToEscape = EscapeChars.None; Assert.AreEqual(dn.ToString(), @"CN=#Pound,Comma=Equals Sign+Plus sign<Less than>Greater than;Semicolon\Backslash""Quote"); }
public void SpacesAtBeginningAndEnd() { DN dn = new DN(@"CN=\ Pete \ ", EscapeChars.SpecialChars); Assert.AreEqual(dn.ToString(), @"CN=\ Pete \ "); dn.CharsToEscape = EscapeChars.None; Assert.AreEqual(dn.ToString(), @"CN= Pete "); }
static void Main(string[] args) { #region Walking the Tree Console.WriteLine("Walking the Tree:"); DN dn1 = new DN("CN=Pete,OU=People,DC=example,DC=com"); Console.WriteLine(dn1); while (dn1.RDNs.Count > 0) { dn1 = dn1.Parent; Console.WriteLine(dn1); } Console.WriteLine("-------------------------------------------"); #endregion #region Equality Test Console.WriteLine("Equality Test:"); string dn2String = "CN = pete ; ou = people;DC=exaMPLE, dc= COM"; string dn3String = "cn=PETE, OU=People,dc=Example , DC = com"; Console.WriteLine(dn2String); Console.WriteLine(new DN(dn2String) == new DN(dn3String) ? "is equal to" : "is not equal to"); Console.WriteLine(dn3String); Console.WriteLine("-------------------------------------------"); #endregion #region Escaping Test Console.WriteLine("Escaping Test:"); char MusicalNote = (char)9835; DN dn4 = new DN("CN=" + MusicalNote + " Music Man,OU=People,DC=example,DC=com"); Console.WriteLine(dn4.ToString(EscapeChars.None)); Console.WriteLine(dn4.ToString(EscapeChars.MultibyteChars)); Console.WriteLine("-------------------------------------------"); #endregion }
public void MultibyteCharacter() { char MusicalNote = (char)0x266B; DN dn1 = new DN("CN=" + MusicalNote + " Music Man,OU=People,DC=example,DC=com", EscapeChars.MultibyteChars); Assert.AreEqual(dn1.ToString(), @"CN=\E2\99\AB Music Man,OU=People,DC=example,DC=com"); dn1.CharsToEscape = EscapeChars.None; Assert.AreEqual(dn1.ToString(), @"CN=" + MusicalNote + " Music Man,OU=People,DC=example,DC=com"); DN dn2 = new DN(@"CN=\E2\99\AB Music Man,OU=People,DC=example,DC=com"); Assert.AreEqual(dn1, dn2); }
public void MultibyteCharacter() { char MusicalNote = (char)0x266B; DN dn1 = new DN("CN=" + MusicalNote + " Music Man,OU=People,DC=example,DC=com", EscapeChars.MultibyteChars); Assert.AreEqual(dn1.ToString(), @"CN=\E2\99\AB Music Man,OU=People,DC=example,DC=com"); dn1.CharsToEscape = EscapeChars.None; Assert.AreEqual(dn1.ToString(), @"CN=" + MusicalNote + " Music Man,OU=People,DC=example,DC=com"); DN dn2 = new DN(@"CN=\E2\99\AB Music Man,OU=People,DC=example,DC=com"); Assert.AreEqual(dn1, dn2); }
public void ToStringReturnsCorrectDnStringRepresentationForSuppliedRdn() { // Fixture setup var dn = new DN(new Rdn(NamingAttribute.Cn, new LdapName("John Doe"))); // Exercise system and verify outcome dn.ToString().Should().Be("CN=John Doe"); }
public void AppendRdnsReturnsUpdatedInstance() { // Fixture setup var dn = new DN(new Rdn(NamingAttribute.Cn, new LdapName("John Doe"))); // Exercise system dn = dn.Append(new Rdn(NamingAttribute.Ou, new LdapName("Users"))); // Verify outcome dn.ToString().Should().Be("CN=John Doe,OU=Users"); }
public void ToStringReturnsCorrectDnStringRepresentationForSuppliedRdnList() { // Fixture setup var comRdn = new Rdn(NamingAttribute.Dc, new LdapName("com")); var domainRdn = new Rdn(NamingAttribute.Dc, new LdapName("domain")); var usersRdn = new Rdn(NamingAttribute.Ou, new LdapName("Users")); var johnRdn = new Rdn(NamingAttribute.Cn, new LdapName("John Doe")); var dn = new DN(johnRdn, usersRdn, domainRdn, comRdn); // Exercise system and verify outcome dn.ToString().Should().Be("CN=John Doe,OU=Users,DC=domain,DC=com"); }
public void MultvaluedRDN() { DN dn = new DN("CN=Pete + SN=Everett"); Assert.AreEqual(dn.ToString(), "CN=Pete+SN=Everett"); }
/// <summary> Returns the DN normalized by removal of non-significant space characters /// as per RFC 2253, section4. /// /// </summary> /// <returns> a normalized string /// </returns> public static string normalize(string dn) { DN testDN = new DN(dn); return(testDN.ToString()); }
public void HexEncodedBinaryValueEnd() { DN dn = new DN("CN=Pete,OU=People,DC=example,DC=#324312af34e4"); Assert.AreEqual(dn.ToString(), "CN=Pete,OU=People,DC=example,DC=#324312af34e4"); }
public void Single() { DN dn = new DN(@"OU=""Pete is cool"""); Assert.AreEqual(dn.ToString(), "OU=Pete is cool"); }
public void HexEscapeNonSpecialCharacter() { DN dn = new DN(@"CN=Pete\20Everett,OU=People,DC=example,DC=com"); Assert.AreEqual(dn.ToString(), @"CN=Pete Everett,OU=People,DC=example,DC=com"); }
public void Semicolons() { DN dn = new DN(@"CN=Pete;OU=People,DC=example;DC=com"); Assert.AreEqual(dn.ToString(), "CN=Pete,OU=People,DC=example,DC=com"); }
public void BlankRDNValue() { DN dn = new DN("CN=,OU=People,DC=example,DC=com"); Assert.AreEqual(dn.ToString(), "CN=,OU=People,DC=example,DC=com"); }
public void WithEscapedSpecialChars() { DN dn = new DN(@"OU=""\,\=\+\<\>\#\;\\\ """); Assert.AreEqual(dn.ToString(), @"OU=\,\=\+\<\>\#\;\\\ "); }
public void End() { DN dn = new DN(@"OU=Pete,OU=is,OU=""cool"""); Assert.AreEqual(dn.ToString(), "OU=Pete,OU=is,OU=cool"); }
public void Middle() { DN dn = new DN(@"OU=Pete,OU=""is"",OU=cool"); Assert.AreEqual(dn.ToString(), "OU=Pete,OU=is,OU=cool"); }
public void End() { DN dn = new DN(@"OU=Pete,OU=is,OU=""cool"""); Assert.AreEqual(dn.ToString(), "OU=Pete,OU=is,OU=cool"); }
public void Beginning() { DN dn = new DN(@"OU=""Pete"",OU=is,OU=cool"); Assert.AreEqual(dn.ToString(), "OU=Pete,OU=is,OU=cool"); }
public void Single() { DN dn = new DN(@"OU=""Pete is cool"""); Assert.AreEqual(dn.ToString(), "OU=Pete is cool"); }
// This is allowed. We should only check for an oid string if it starts with // OID (or oid) followed by a period. public void NotQuiteAnOID() { DN dn = new DN("OID33A-2=Pete"); Assert.AreEqual(dn.ToString(), "OID33A-2=Pete"); }
public void NonDCNaming() { DN dn = new DN(@"CN=Pete,OU=People,O=Example Inc.,C=US"); Assert.AreEqual(dn.ToString(), "CN=Pete,OU=People,O=Example Inc.,C=US"); }
public void NotQuiteAnOID() { DN dn = new DN("OID33A-2=Pete"); Assert.AreEqual(dn.ToString(), "OID33A-2=Pete"); }
public void ExtraSpaces() { DN dn = new DN(@" CN = Pete , OU = People,DC = example,DC = com"); Assert.AreEqual(dn.ToString(), "CN=Pete,OU=People,DC=example,DC=com"); }
public void Run(params string[] args) { PhoneSystem ps = PhoneSystem.Root; System.Console.WriteLine("Parameters:"); foreach (Parameter p in ps.GetParameters()) { System.Console.WriteLine("\t" + p.ToString()); } System.Console.WriteLine("Codecs:"); foreach (Codec c in ps.GetCodecs()) { System.Console.WriteLine("\t" + c.ToString()); } System.Console.WriteLine("Conditions:"); foreach (RuleCondition rc in ps.GetRuleConditions()) { System.Console.WriteLine("\t" + rc.ToString()); } System.Console.WriteLine("RuleHours:"); foreach (RuleHours rh in ps.GetRuleHourTypes()) { System.Console.WriteLine("\t" + rh.ToString()); } System.Console.WriteLine("RuleCalltype:"); foreach (RuleCallType rct in ps.GetRuleCallTypes()) { System.Console.WriteLine("\t" + rct.ToString()); } foreach (Tenant t in ps.GetTenants()) { System.Console.WriteLine(t.ToString()); System.Console.WriteLine("\tOfficeHours:"); foreach (HoursRange hr in t.OfficeHoursRanges) { System.Console.WriteLine("\t\t" + hr); } System.Console.WriteLine("\tExtensions:"); foreach (Extension e in t.GetExtensions()) { System.Console.WriteLine("\t\t" + e); System.Console.WriteLine("\t\t\tProperties:"); foreach (DNProperty d in e.GetProperties()) { System.Console.WriteLine("\t\t\t\t" + d); } System.Console.WriteLine("\t\t\tForwarding:"); foreach (ExtensionRule er in e.ForwardingRules) { System.Console.WriteLine("\t\t\t\t" + er); } } foreach (IVR ivr in t.GetIVRs()) { System.Console.WriteLine("\t\t" + ivr.Name); System.Console.WriteLine("\t\t\t" + ivr.Number); System.Console.WriteLine("\t\t\t" + ivr.PromptFilename); System.Console.WriteLine("\t\t\t" + ivr.Timeout); System.Console.WriteLine("\t\t\t" + ivr.TimeoutForwardType.ToString()); DN dn = ivr.TimeoutForwardDN; if (dn != null) { System.Console.WriteLine("\t\t\t" + dn.ToString()); } else { System.Console.WriteLine("\t\t\t" + "not specified"); } } } }
public void EmptyString() { DN dn = new DN(""); Assert.AreEqual(dn.ToString(), ""); }
public void WithUnescapedSpecialChars() { DN dn = new DN(@"OU="",=+<>#; """); Assert.AreEqual(dn.ToString(), @"OU=\,\=\+\<\>\#\;\ "); }
public void HexEncodedBinaryValueSingle() { DN dn = new DN("CN=#324312af34e4"); Assert.AreEqual(dn.ToString(), "CN=#324312af34e4"); }
public void HexEncodedBinaryValueBeginning() { DN dn = new DN("CN=#324312af34e4,OU=People,DC=example,DC=com"); Assert.AreEqual(dn.ToString(), "CN=#324312af34e4,OU=People,DC=example,DC=com"); }
public void Middle() { DN dn = new DN(@"OU=Pete,OU=""is"",OU=cool"); Assert.AreEqual(dn.ToString(), "OU=Pete,OU=is,OU=cool"); }
public void HexEncodedBinaryValueMiddle() { DN dn = new DN("CN=Pete,OU=#324312af34e4,DC=example,DC=com"); Assert.AreEqual(dn.ToString(), "CN=Pete,OU=#324312af34e4,DC=example,DC=com"); }
public void Beginning() { DN dn = new DN(@"OU=""Pete"",OU=is,OU=cool"); Assert.AreEqual(dn.ToString(), "OU=Pete,OU=is,OU=cool"); }
public void HexEscapeNonSpecialCharacter() { DN dn = new DN(@"CN=Pete\20Everett,OU=People,DC=example,DC=com"); Assert.AreEqual(dn.ToString(), @"CN=Pete Everett,OU=People,DC=example,DC=com"); }