Beispiel #1
0
 public void FixtureSetUp()
 {
     cd    = new CodeDirective();
     array = new CodeDirective[1] {
         cd
     };
 }
Beispiel #2
0
        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");
        }
        static CodeDirective[] _ToArray(CodeDirectiveCollection dirs)
        {
            var result = new CodeDirective[dirs.Count];

            dirs.CopyTo(result, 0);
            return(result);
        }
Beispiel #4
0
        public void Constructor1_NullItem()
        {
            CodeDirective[] directives = new CodeDirective[] {
                new CodeDirective(), null
            };

            CodeDirectiveCollection coll = new CodeDirectiveCollection(
                directives);
        }
Beispiel #5
0
 protected virtual void Visit(CodeDirective directive)
 {
     if (directive is CodeChecksumPragma)
     {
         Visit((CodeChecksumPragma)directive);
     }
     else if (directive is CodeRegionDirective)
     {
         Visit((CodeRegionDirective)directive);
     }
 }
        protected virtual void Write(IndentedTextWriter writer, CodeDirective directive)
        {
            switch (directive)
            {
            case CodeUsingDirective o:
                Write(writer, o);
                break;

            default:
                throw new NotSupportedException();
            }
        }
 private static void ProcessDirective(CodeDirective directive, CodeDomGenerator.Language language)
 {
     //if (language == CodeDomGenerator.Language.CSharp)
     //{
     //    if (directive is CodeRegionDirective)
     //    {
     //        CodeRegionDirective r = directive as CodeRegionDirective;
     //        if (!r.RegionText.StartsWith("\""))
     //            r.RegionText = "\"" + r.RegionText + "\"";
     //    }
     //}
 }
Beispiel #8
0
        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");
        }
Beispiel #9
0
        public void Insert()
        {
            CodeDirective cd1 = new CodeDirective();
            CodeDirective cd2 = new CodeDirective();

            CodeDirectiveCollection coll = new CodeDirectiveCollection();

            coll.Add(cd1);
            Assert.AreEqual(1, coll.Count, "#1");
            Assert.AreEqual(0, coll.IndexOf(cd1), "#2");
            coll.Insert(0, cd2);
            Assert.AreEqual(2, coll.Count, "#3");
            Assert.AreEqual(1, coll.IndexOf(cd1), "#4");
            Assert.AreEqual(0, coll.IndexOf(cd2), "#5");
        }
Beispiel #10
0
 private static void ValidateCodeDirective(CodeDirective e)
 {
     if (e is CodeChecksumPragma)
     {
         ValidateChecksumPragma((CodeChecksumPragma)e);
     }
     else if (e is CodeRegionDirective)
     {
         ValidateRegionDirective((CodeRegionDirective)e);
     }
     else
     {
         throw new ArgumentException(SR.GetString(SR.InvalidElementType, e.GetType().FullName), "e");
     }
 }
Beispiel #11
0
 private static void ValidateCodeDirective(CodeDirective e)
 {
     if (e is CodeChecksumPragma)
     {
         ValidateChecksumPragma((CodeChecksumPragma)e);
     }
     else
     {
         if (!(e is CodeRegionDirective))
         {
             throw new ArgumentException(SR.GetString("InvalidElementType", new object[] { e.GetType().FullName }), "e");
         }
         ValidateRegionDirective((CodeRegionDirective)e);
     }
 }
Beispiel #12
0
        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");
        }
Beispiel #13
0
 private static void ValidateCodeDirective(CodeDirective e)
 {
     if (e is CodeChecksumPragma)
     {
         ValidateChecksumPragma((CodeChecksumPragma)e);
     }
     else if (e is CodeRegionDirective)
     {
         ValidateRegionDirective((CodeRegionDirective)e);
     }
     else
     {
         throw new ArgumentException(SR.Format(SR.InvalidElementType, e.GetType().FullName), nameof(e));
     }
 }
Beispiel #14
0
 public bool Contains(CodeDirective value)
 {
 }
Beispiel #15
0
 public int Add(CodeDirective value)
 {
     return(List.Add(value));
 }
Beispiel #16
0
 public int IndexOf(CodeDirective value)
 {
     return(List.IndexOf(value));
 }
	public bool Contains(CodeDirective value) {}
	public void AddRange(CodeDirective[] value) {}
Beispiel #19
0
 public void Remove(CodeDirective value)
 {
     List.Remove(value);
 }
Beispiel #20
0
 protected override void Visit(CodeDirective directive)
 {
     base.Visit(directive);
 }
	public void CopyTo(CodeDirective[] array, int index) {}
Beispiel #22
0
 public bool Contains(CodeDirective value)
 {
     return(List.Contains(value));
 }
	public int IndexOf(CodeDirective value) {}
Beispiel #24
0
 public void Insert(int index, CodeDirective value)
 {
 }
Beispiel #25
0
 public static T EndDirective <T>(this T member, CodeDirective directive)
     where T : CodeTypeMember
 {
     member.EndDirectives.Add(directive);
     return(member);
 }
	public void Insert(int index, CodeDirective value) {}
Beispiel #27
0
 public void Insert(int index, CodeDirective value)
 {
     List.Insert(index, value);
 }
Beispiel #28
0
 // Methods
 public int Add(CodeDirective value)
 {
 }
	public void Remove(CodeDirective value) {}
Beispiel #30
0
 public int IndexOf(CodeDirective value)
 {
 }
	public CodeDirectiveCollection(CodeDirective[] value) {}
Beispiel #32
0
 public void Remove(CodeDirective value)
 {
 }
	// Methods
	public int Add(CodeDirective value) {}