public void Constructor0 () { CodeDirectiveCollection coll = new CodeDirectiveCollection (); Assert.IsFalse (((IList) coll).IsFixedSize, "#1"); Assert.IsFalse (((IList) coll).IsReadOnly, "#2"); Assert.AreEqual (0, coll.Count, "#3"); Assert.IsFalse (((ICollection) coll).IsSynchronized, "#4"); }
public void Constructor1_NullItem () { CodeDirective[] directives = new CodeDirective[] { new CodeDirective (), null }; CodeDirectiveCollection coll = new CodeDirectiveCollection ( directives); }
public void AddRange(CodeDirectiveCollection value) { if (value == null) { throw new ArgumentNullException("value"); } int currentCount = value.Count; for (int i = 0; i < currentCount; i = ((i) + (1))) { this.Add(value[i]); } }
public void AddRange (CodeDirectiveCollection value) { if (value == null) { throw new ArgumentNullException ("value"); } int count = value.Count; for (int i = 0; i < count; i++) { Add (value[i]); } }
public void Constructor1 () { CodeDirective cd1 = new CodeDirective (); CodeDirective cd2 = new CodeDirective (); CodeDirective[] directives = new CodeDirective[] { cd1, cd2 }; CodeDirectiveCollection coll = new CodeDirectiveCollection ( directives); Assert.AreEqual (2, coll.Count, "#1"); Assert.AreEqual (0, coll.IndexOf (cd1), "#2"); Assert.AreEqual (1, coll.IndexOf (cd2), "#3"); }
public void AddRange(CodeDirectiveCollection value) { if (value == null) { throw new ArgumentNullException("value"); } int currentCount = value.Count; for (int i = 0; i < currentCount; i = ((i) + (1))) { this.Add(value[i]); } }
public void Constructor1_Deny_Unrestricted () { CodeDirectiveCollection coll = new CodeDirectiveCollection (array); coll.CopyTo (array, 0); Assert.AreEqual (1, coll.Add (cd), "Add"); Assert.AreSame (cd, coll[0], "this[int]"); coll.AddRange (array); coll.AddRange (coll); Assert.IsTrue (coll.Contains (cd), "Contains"); Assert.AreEqual (0, coll.IndexOf (cd), "IndexOf"); coll.Insert (0, cd); coll.Remove (cd); }
public void AddRange(CodeDirectiveCollection value) { if (value == null) { throw new ArgumentNullException("value"); } int count = value.Count; for (int i = 0; i < count; i++) { Add(value[i]); } }
protected override void GenerateDirectives (CodeDirectiveCollection directives) { foreach (CodeDirective d in directives) { if (d is CodeChecksumPragma) { GenerateCodeChecksumPragma ((CodeChecksumPragma)d); continue; } if (d is CodeRegionDirective) { GenerateCodeRegionDirective ((CodeRegionDirective)d); continue; } throw new NotImplementedException ("Unknown CodeDirective"); } }
/// <summary> /// Visits a <see cref="CodeDirectiveCollection"/>. /// </summary> /// <param name="codeDirectiveCollection">The <see cref="CodeDirectiveCollection"/> to visit.</param> protected virtual void VisitCodeDirectiveCollection(CodeDirectiveCollection codeDirectiveCollection) { // Visit all of the CodeDirective items in the collection. foreach (CodeDirective item in codeDirectiveCollection.Cast<CodeDirective>()) { this.VisitCodeDirective(item); } }
public void AddRange () { CodeDirective cd1 = new CodeDirective (); CodeDirective cd2 = new CodeDirective (); CodeDirective cd3 = new CodeDirective (); CodeDirectiveCollection coll1 = new CodeDirectiveCollection (); coll1.Add (cd1); coll1.Add (cd2); CodeDirectiveCollection coll2 = new CodeDirectiveCollection (); coll2.Add (cd3); coll2.AddRange (coll1); Assert.AreEqual (3, coll2.Count, "#1"); Assert.AreEqual (1, coll2.IndexOf (cd1), "#2"); Assert.AreEqual (2, coll2.IndexOf (cd2), "#3"); Assert.AreEqual (0, coll2.IndexOf (cd3), "#4"); CodeDirectiveCollection coll3 = new CodeDirectiveCollection (); coll3.Add (cd3); coll3.AddRange (new CodeDirective[] { cd1, cd2 }); Assert.AreEqual (3, coll2.Count, "#5"); Assert.AreEqual (1, coll2.IndexOf (cd1), "#6"); Assert.AreEqual (2, coll2.IndexOf (cd2), "#7"); Assert.AreEqual (0, coll2.IndexOf (cd3), "#8"); }
private void GenerateDirectives(CodeDirectiveCollection directives) { for (int num1 = 0; num1 < directives.Count; num1++) { CodeDirective directive1 = directives[num1]; if (directive1 is CodeChecksumPragma) { this.GenerateChecksumPragma((CodeChecksumPragma) directive1); } else if (directive1 is CodeRegionDirective) { this.GenerateCodeRegionDirective((CodeRegionDirective) directive1); } } }
protected override void GenerateDirectives (CodeDirectiveCollection directives) { foreach (CodeDirective d in directives) { var r = d as CodeRegionDirective; if (r != null) { if (r.RegionMode == CodeRegionMode.Start) { Output.WriteLine (); Output.Write ("(region "); Output.Write (r.RegionText); ++Indent; } else if (r.RegionMode == CodeRegionMode.End) { Output.Write (")"); --Indent; } } } }
public void AddRange_Self () { CodeDirectiveCollection coll = new CodeDirectiveCollection (); coll.Add (new CodeDirective ()); Assert.AreEqual (1, coll.Count, "#1"); coll.AddRange (coll); Assert.AreEqual (2, coll.Count, "#2"); }
protected override void GenerateDirectives(CodeDirectiveCollection directives) { foreach (CodeDirective directive in directives) { var cdr = directive as CodeRegionDirective; if (cdr != null) { Output.WriteLine(cdr.RegionText); } } }
protected virtual void GenerateDirectives (CodeDirectiveCollection directives) { }
public void Insert_Null () { CodeDirectiveCollection coll = new CodeDirectiveCollection (); coll.Insert (0, (CodeDirective) null); }
protected void Rewrite(CodeDirectiveCollection target, CodeDirectiveCollection source, ref bool didRewrite) { foreach (CodeDirective item in source) { target.Add(this.Rewrite(item, ref didRewrite)); } }
public static CodeDirectiveCollection Clone(CodeDirectiveCollection directivecol) { CodeDirectiveCollection clone = new CodeDirectiveCollection(directivecol); return clone; }
public void Remove_Null () { CodeDirectiveCollection coll = new CodeDirectiveCollection (); coll.Remove ((CodeDirective) null); }
public void Remove_NotInCollection () { CodeDirectiveCollection coll = new CodeDirectiveCollection (); coll.Remove (new CodeDirective ()); }
public void Remove () { CodeDirective cd1 = new CodeDirective (); CodeDirective cd2 = new CodeDirective (); CodeDirectiveCollection coll = new CodeDirectiveCollection (); coll.Add (cd1); coll.Add (cd2); Assert.AreEqual (2, coll.Count, "#1"); Assert.AreEqual (0, coll.IndexOf (cd1), "#2"); Assert.AreEqual (1, coll.IndexOf (cd2), "#3"); coll.Remove (cd1); Assert.AreEqual (1, coll.Count, "#4"); Assert.AreEqual (-1, coll.IndexOf (cd1), "#5"); Assert.AreEqual (0, coll.IndexOf (cd2), "#6"); }
private static void ValidateCodeDirectives(CodeDirectiveCollection e) { for (int i=0; i<e.Count; i++) ValidateCodeDirective(e[i]); }
public void Constructor2 () { CodeDirective cd1 = new CodeDirective (); CodeDirective cd2 = new CodeDirective (); CodeDirectiveCollection c = new CodeDirectiveCollection (); c.Add (cd1); c.Add (cd2); CodeDirectiveCollection coll = new CodeDirectiveCollection (c); Assert.AreEqual (2, coll.Count, "#1"); Assert.AreEqual (0, coll.IndexOf (cd1), "#2"); Assert.AreEqual (1, coll.IndexOf (cd2), "#3"); }
public void AddRange(CodeDirectiveCollection value) { throw new NotImplementedException(); }
public void AddRange_Null_Collection () { CodeDirectiveCollection coll = new CodeDirectiveCollection (); coll.AddRange ((CodeDirectiveCollection) null); }
public CodeDirectiveCollection(CodeDirectiveCollection value) { this.AddRange(value); }
public void Add_Null () { CodeDirectiveCollection coll = new CodeDirectiveCollection (); coll.Add ((CodeDirective) null); }
protected override void GenerateDirectives(CodeDirectiveCollection directives) { for (int i = 0; i < directives.Count; i++) { CodeDirective directive = directives[i]; if (directive is CodeChecksumPragma) { this.GenerateChecksumPragma((CodeChecksumPragma)directive); } else if (directive is CodeRegionDirective) { this.GenerateCodeRegionDirective((CodeRegionDirective)directive); } } }
public void Constructor1_Null () { CodeDirectiveCollection coll = new CodeDirectiveCollection ( (CodeDirective[]) null); }
public CodeDirectiveCollection(CodeDirectiveCollection value) { AddRange(value); }
public CodeDirectiveCollection(CodeDirectiveCollection value) { throw new NotImplementedException(); }