public void UnescapedSpecialCharacter() { Assert.Throws <ArgumentException>(() => { DN dn = new DN(@"CN=Winkin, Blinkin, and Nod,OU=People,DC=example,DC=com"); }); }
Flip32(DN n1, DN n2, DN n3, d3 p31, d3 p12, d3 p23, d3 apex_x, d3 apex_y) { d3 a = p31; d3 b = p12; d3 c = p23; DN nx = new DN(a, b, c, apex_x); DN ny = new DN(a, b, c, apex_y); nx.neighbor.Add(ny); ny.neighbor.Add(nx); TR xab = new TR(apex_x, a, b); TR yab = new TR(apex_y, a, b); TR xbc = new TR(apex_x, b, c); TR ybc = new TR(apex_y, b, c); TR xca = new TR(apex_x, c, a); TR yca = new TR(apex_y, c, a); n1.SetNeighbor(nx, xab); n2.SetNeighbor(nx, xbc); n3.SetNeighbor(nx, xca); n1.SetNeighbor(ny, yab); n2.SetNeighbor(ny, ybc); n3.SetNeighbor(ny, yca); return(xab, xbc, xca, yab, ybc, yca, nx, ny); }
public void MixedCase() { Assert.Throws <ArgumentException>(() => { DN dn = new DN("oId.3.23.1=Pete"); }); }
public static Node Register(DN dn, IMBean obj) { Node node = Node.Root; lock (Nodes) { foreach (RDN rdn in dn.RDNs) { string nodeText = null; foreach (RDNComponent comp in rdn.Components) { nodeText = comp.ComponentType + "=" + comp.ComponentValue; break; } if (node.Children.ContainsKey(nodeText)) { node = node.Children[nodeText]; } else { Node newNode = new Node(nodeText, node); node.Children.Add(newNode.Text, newNode); Node.Nodes.Add(newNode.Id, newNode); node = newNode; } } } node.Payload = obj; return(node); }
public void LeadingZeroEnd2() { Assert.Throws <ArgumentException>(() => { DN dn = new DN("OID.32.21.05=Pete"); }); }
public void LeadingZeroBeginning2() { Assert.Throws <ArgumentException>(() => { DN dn = new DN("OID.03.23.1=Pete"); }); }
public void Run(params string[] args) { Tenant t = PhoneSystem.Root.GetTenants()[0]; DN e = null; foreach (DN dn in t.GetDN()) { if (dn.Number == "108") { e = dn; } } PhoneBookEntry a = t.CreatePhoneBookEntry(); a.FirstName = "TenantFN"; a.LastName = "TenantLN"; a.PhoneNumber = "54321"; a.Save(); a = e.CreatePhoneBookEntry(); a.FirstName = "ExtFN"; a.LastName = "ExtLN"; a.PhoneNumber = "7890"; a.Save(); Thread.Sleep(2000); t.Refresh(); e.Refresh(); foreach (PhoneBookEntry pbe in t.GetPhoneBookEntries()) { System.Console.WriteLine(pbe.ToString()); } foreach (PhoneBookEntry pbe in e.GetPhoneBookEntries()) { System.Console.WriteLine(pbe.ToString()); } }
public static (SG s1, SG s2, SG s3, DN n1, DN n2, DN n3) Split(DN n, V2 p) { var t = n.triangle; if (t.Includes(p, false)) { var ab = new DN(t.a, t.b, p); var bc = new DN(t.b, t.c, p); var ca = new DN(t.c, t.a, p); ab.neighbor = new List <DN> { bc, ca }; bc.neighbor = new List <DN> { ca, ab }; ca.neighbor = new List <DN> { ab, bc }; n.SetNeighbors(ab, t.a, t.b); n.SetNeighbors(bc, t.b, t.c); n.SetNeighbors(ca, t.c, t.a); return(new SG(t.a, t.b), new SG(t.b, t.c), new SG(t.c, t.a), ab, bc, ca); } else { throw new Exception("degenerated case like points on edge"); } }
/// <summary> /// Initializes the Entry specific properties e.g entry DN etc. /// </summary> void InitEntry() { LdapUrl lUrl = new LdapUrl(ADsPath); string dn = lUrl.getDN(); if (dn != null) { if (String.Compare(dn, "rootDSE", true) == 0) { InitToRootDse(lUrl.Host, lUrl.Port); } else { DN userDn = new DN(dn); String[] lRdn = userDn.explodeDN(false); _Name = (string)lRdn[0]; _Parent = new DirectoryEntry(conn); _Parent.Path = GetLdapUrlString(lUrl.Host, lUrl.Port, userDn.Parent.ToString()); } } else { _Name = lUrl.Host + ":" + lUrl.Port; _Parent = new DirectoryEntry(conn); _Parent.Path = "Ldap:"; } }
public void TrailingPeriod() { Assert.Throws <ArgumentException>(() => { DN dn = new DN("OID.34.54.15.=Pete"); }); }
public void LeadingZeroMiddle2() { Assert.Throws <ArgumentException>(() => { DN dn = new DN("OID.34.03.21=Pete"); }); }
public void MustHave4NeighborExceptMostOuter([ValueSource(nameof(nums))] int num) { var bf = new BistellarFlip3D(num, 1); var rt = new DN(new d3(0, 0, 0), new d3(3, 0, 0), new d3(0, 3, 0), new d3(0, 0, 3)); bf.Nodes.ForEach(n => { var t = n.tetrahedra; var c = 0; Assert.IsTrue(rt.Contains(t.a, true) && rt.Contains(t.b, true) && rt.Contains(t.c, true) && rt.Contains(t.d, true)); if (rt.Contains(t.a, false)) { c++; } if (rt.Contains(t.b, false)) { c++; } if (rt.Contains(t.c, false)) { c++; } if (rt.Contains(t.d, false)) { c++; } if (c >= 2) { Assert.IsTrue(n.neighbor.Count == 4); } }); }
public void AllSpaces() { Assert.Throws <ArgumentException>(() => { DN dn = new DN(" "); }); }
public void AdjacentPeriods() { Assert.Throws <ArgumentException>(() => { DN dn = new DN("34..32.15=Pete"); }); }
public void MalformedRDN() { Assert.Throws <ArgumentException>(() => { DN dn = new DN("CN=Pete,People,DC=example,DC=com"); }); }
public void TypeBeginsWithNumber() { Assert.Throws <ArgumentException>(() => { DN dn = new DN("3N=Pete"); }); }
public void WithUnterminatedQuotedString() { Assert.Throws <ArgumentException>(() => { DN dn = new DN(@"OU=""Pete is cool"); }); }
public static void Unregister(DN dn) { lock (Nodes) { Node node = Node.Root; foreach (RDN rdn in dn.RDNs) { string nodeText = null; foreach (RDNComponent comp in rdn.Components) { nodeText = comp.ComponentType + "=" + comp.ComponentValue; break; } if (node.Children.ContainsKey(nodeText)) { node = node.Children[nodeText]; } else { return; // Not found } } // Remove the node node.Remove(); } }
public void InvalidHexEncodedBinaryValueLength() { Assert.Throws <ArgumentException>(() => { DN dn = new DN("CN=#35fe1,OU=People,DC=example,DC=com"); }); }
public void Time(string s) { DateTime DN; if (DateTime.TryParseExact(s, "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out DN)) { DN = DateTime.ParseExact(s, "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None); if (DN.CompareTo(D) < 0) { Console.WriteLine("\nВыбранная дата раньше даты производства\n"); } else { DateTime DL = D.AddYears(S); if (DN.CompareTo(DL) > 0) { Console.WriteLine("\nНельзя запускать\n"); } else { Console.WriteLine("\nМожно запускать\n"); } } } else { Console.WriteLine("\nНеверный ввод\n"); } Console.ReadKey(); Console.Clear(); }
void AddEntry(string name, Connection conn, TreeIter iter) { try { Pixbuf pb = Pixbuf.LoadFromResource("x-directory-normal.png"); LdapEntry[] ldapEntries = conn.Data.GetEntryChildren(name); foreach (LdapEntry le in ldapEntries) { Log.Debug("\tchild: {0}", le.DN); DN dn = new DN(le.DN); RDN rdn = (RDN)dn.RDNs[0]; TreeIter newChild; newChild = browserStore.AppendValues(iter, pb, le.DN, rdn.Value); browserStore.AppendValues(newChild, pb, "", ""); } } catch { string msg = Mono.Unix.Catalog.GetString( "Unable to read data from server"); HIGMessageDialog dialog = new HIGMessageDialog( parent, 0, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, "Network error", msg); dialog.Run(); dialog.Destroy(); } }
public void InvalidCharsInHexEncodedBinaryValue() { Assert.Throws <ArgumentException>(() => { DN dn = new DN("CN=#34fer4,OU=People,DC=example,DC=com"); }); }
public static bool equals(string dn1, string dn2) { DN dnA = new DN(dn1); DN dnB = new DN(dn2); return(dnA.Equals(dnB)); }
public void LeadingZeroMiddle3() { DN dn1 = new DN("34.0.21=Pete"); DN dn2 = new DN("OID.34.0.21=Pete"); Assert.AreEqual(dn1, dn2); }
public void LeadingZeroEnd3() { DN dn1 = new DN("32.21.0=Pete"); DN dn2 = new DN("OID.32.21.0=Pete"); Assert.AreEqual(dn1, dn2); }
// This next one actually valid. You're allowed to have a zero...just not a // non-zero number with a leading zero. public void LeadingZeroBeginning3() { DN dn1 = new DN("0.23.1=Pete"); DN dn2 = new DN("oid.0.23.1=Pete"); 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 DomainReturnsNullIfNoDcRdns() { // Fixture setup var dn = DN.Parse("CN=John,OU=Users"); // Exercise system and verify outcome dn.Domain.Should().BeNull(); }
void ReplaceFacingNode(TR t, DN replacer) { if (!replacer.HasFacet(t)) { return; } neighbor = neighbor.Select(n => n.HasFacet(t) ? replacer : n).ToList(); }
void ReplaceFacingNode(SG e, DN replacer) { if (!replacer.Contains(e)) { return; } neighbor = neighbor.Select(n => n.Contains(e) ? replacer : n).ToList(); }
public void Beginning() { DN dn1 = new DN(@"OID.3.43.128=Pete,OU=People,DC=example,DC=com"); DN dn2 = new DN(@"3.43.128=Pete,OU=People,DC=example,DC=com"); DN dn3 = new DN(@"oid.3.43.128=Pete,OU=People,DC=example,DC=com"); Assert.AreEqual(dn1,dn2); Assert.AreEqual(dn2,dn3); }
public void End() { DN dn1 = new DN(@"OU=People,DC=example,OID.3.43.128=com"); DN dn2 = new DN(@"OU=People,DC=example,3.43.128=com"); DN dn3 = new DN(@"OU=People,DC=example,oid.3.43.128=com"); Assert.AreEqual(dn1,dn2); Assert.AreEqual(dn2,dn3); }
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 EqualsOperator() { DN dn1 = new DN("Cn=PETE,oU=pEoPle,DC=exAMplE,Dc=cOM"); DN dn2 = new DN("CN=pete,OU=people,DC=example,DC=com"); DN dn3 = new DN("CN=peter,OU=people,DC=example,DC=com"); Assert.IsTrue(dn1 == dn2); Assert.IsFalse(dn1 == dn3); }
public void HashCode() { DN dn1 = new DN("Cn=PETE,oU=pEoPle,DC=exAMplE,Dc=cOM"); DN dn2 = new DN("CN=pete,OU=people , DC=example,DC=com"); DN dn3 = new DN("CN=peter,OU=people,DC=example,DC=com"); Assert.AreEqual(dn1.GetHashCode(), dn2.GetHashCode()); Assert.IsFalse(dn1.GetHashCode() == dn3.GetHashCode()); }
public void Contains() { DN dn1 = new DN("CN=Pete,OU=People,DC=example,DC=com"); DN dn2 = new DN("OU=People,DC=example,DC=com"); DN dn3 = new DN("DC=example,DC=com"); Assert.IsTrue(dn2.Contains(dn1)); Assert.IsTrue(dn3.Contains(dn1)); Assert.IsTrue(dn3.Contains(dn2)); Assert.IsFalse(dn1.Contains(dn2)); Assert.IsFalse(dn1.Contains(dn3)); Assert.IsFalse(dn2.Contains(dn3)); }
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 LeadingZeroMiddle2() { DN dn = new DN("OID.34.03.21=Pete"); }
public void Middle() { DN dn1 = new DN(@"CN=Pete,OID.3.43.128=Pete,OU=People,DC=example,DC=com"); DN dn2 = new DN(@"CN=Pete,3.43.128=Pete,OU=People,DC=example,DC=com"); DN dn3 = new DN(@"CN=Pete,oid.3.43.128=Pete,OU=People,DC=example,DC=com"); Assert.AreEqual(dn1,dn2); Assert.AreEqual(dn2,dn3); }
public void LeadingZeroBeginning3() { DN dn1 = new DN("0.23.1=Pete"); DN dn2 = new DN("oid.0.23.1=Pete"); Assert.AreEqual(dn1, dn2); }
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 WithUnescapedSpecialChars() { DN dn = new DN(@"OU="",=+<>#; """); Assert.AreEqual(dn.ToString(), @"OU=\,\=\+\<\>\#\;\ "); }
public void LeadingZeroEnd2() { DN dn = new DN("OID.32.21.05=Pete"); }
public void Spaces() { DN dn1 = new DN(" 32.21.0 = Pete"); DN dn2 = new DN("OID.32.21.0=Pete"); DN dn3 = new DN("oid.32.21.0 = Pete "); Assert.AreEqual(dn1, dn2); Assert.AreEqual(dn2, dn3); }
public void TrailingPeriod() { DN dn = new DN("OID.34.54.15.=Pete"); }
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 AdjacentPeriods() { DN dn = new DN("34..32.15=Pete"); }
public void LeadingZeroBeginning1() { DN dn1 = new DN("03.23.1=Pete"); }
public void LeadingZeroBeginning2() { DN dn = new DN("OID.03.23.1=Pete"); }
public void LeadingZeroMiddle1() { DN dn = new DN("34.03.21=Pete"); }
public void UnescapedSpecialCharacter() { DN dn = new DN(@"CN=Winkin, Blinkin, and Nod,OU=People,DC=example,DC=com"); }
public void WithUnterminatedQuotedString() { DN dn = new DN(@"OU=""Pete is cool"); }
public void Single() { DN dn1 = new DN(@"OID.3.43.128=Pete"); DN dn2 = new DN(@"3.43.128=Pete"); DN dn3 = new DN(@"oid.3.43.128=Pete"); Assert.AreEqual(dn1,dn2); Assert.AreEqual(dn2,dn3); }
public void Single() { DN dn = new DN(@"OU=""Pete is cool"""); Assert.AreEqual(dn.ToString(), "OU=Pete is cool"); }
public void NotQuiteAnOID() { DN dn = new DN("OID33A-2=Pete"); Assert.AreEqual(dn.ToString(), "OID33A-2=Pete"); }
public void MixedCase() { DN dn = new DN("oId.3.23.1=Pete"); }
public void LeadingZeroEnd1() { DN dn = new DN("32.21.05=Pete"); }