예제 #1
0
        public void Init()
        {
            TypeCode.Clear();
            var a = TypeCode.Set("A", nousings, "acode1", nodeps);

            Assert.IsFalse(a.CodeChanged);
        }
예제 #2
0
        public void ZeroUsingsNoNamespace()
        {
            TypeCode.Clear();
            var a   = TypeCode.Set("A", nousings, "acode1", nodeps, "");
            var lib = a.GetLinkedCode();

            Assert.AreEqual("\nacode1", lib.Declarations);
        }
예제 #3
0
        public void NoDeps()
        {
            TypeCode.Clear();
            var a   = TypeCode.Set("A", nousings, "acode1", nodeps);
            var lib = a.GetLinkedCode();

            Assert.AreEqual(1, lib.Types.Length);
        }
예제 #4
0
        public void Changed()
        {
            TypeCode.Clear();
            var a = TypeCode.Set("A", nousings, "acode1", nodeps);

            TypeCode.Set("A", nousings, "acode2", nodeps);
            Assert.IsTrue(a.CodeChanged);
        }
예제 #5
0
        public void RecDepNoChange()
        {
            TypeCode.Clear();
            var a   = TypeCode.Set("A", nousings, "acode1", new[] { "A", "B" });
            var b   = TypeCode.Set("B", nousings, "bcode1", new[] { "A", "B" });
            var lib = a.GetLinkedCode();

            Assert.AreEqual(2, lib.Types.Length);
        }
예제 #6
0
        public void Two()
        {
            TypeCode.Clear();
            var a   = TypeCode.Set("A", nousings, "acode1", nodeps, "N.M");
            var lib = a.GetLinkedCode();

            Assert.IsTrue(lib.Declarations.Contains("namespace N.M"));
            Assert.IsTrue(lib.ValueExpression.StartsWith("new N.M.A", StringComparison.Ordinal));
        }
예제 #7
0
        public void Zero()
        {
            TypeCode.Clear();
            var a   = TypeCode.Set("A", nousings, "acode1", nodeps);
            var lib = a.GetLinkedCode();

            Assert.AreEqual("", a.FullNamespace);
            Assert.IsTrue(lib.ValueExpression.StartsWith("new A", StringComparison.Ordinal));
        }
예제 #8
0
        public void OneUsingNoNamespace()
        {
            TypeCode.Clear();
            var a = TypeCode.Set("A", new [] {
                "using System;",
            }, "acode1", nodeps, "");
            var lib = a.GetLinkedCode();

            Assert.AreEqual("using System;\nacode1", lib.Declarations);
        }
예제 #9
0
        public void OneLevel()
        {
            TypeCode.Clear();
            var a       = TypeCode.Set("A", nousings, "acode1", new [] { "B", "C" });
            var allDeps = a.AllDependencies;

            Assert.AreEqual(3, allDeps.Count);
            Assert.IsTrue(allDeps.Contains(TypeCode.Get("A")));
            Assert.IsTrue(allDeps.Contains(TypeCode.Get("B")));
            Assert.IsTrue(allDeps.Contains(TypeCode.Get("C")));
        }
예제 #10
0
        public void TwoUsingsNoNamespace()
        {
            TypeCode.Clear();
            var a = TypeCode.Set("A", new [] {
                "using System;",
                "using System.Collections.Generic;",
            }, "acode1", nodeps, "");
            var lib = a.GetLinkedCode();

            Assert.AreEqual("using System;\nusing System.Collections.Generic;\nacode1", lib.Declarations);
        }
예제 #11
0
        public void FarRecDepNoChange()
        {
            TypeCode.Clear();
            var a   = TypeCode.Set("A", nousings, "acode1", new[] { "A", "B" });
            var b   = TypeCode.Set("B", nousings, "bcode1", new[] { "B", "C" });
            var c   = TypeCode.Set("C", nousings, "ccode1", new[] { "A", "C" });
            var d   = TypeCode.Set("D", nousings, "dcode1", new[] { "D", "E" });
            var lib = a.GetLinkedCode();

            Assert.AreEqual(3, lib.Types.Length);
        }
예제 #12
0
        public void Recursive()
        {
            TypeCode.Clear();
            var a       = TypeCode.Set("A", nousings, "acode1", new [] { "A", "B", "C" });
            var b       = TypeCode.Set("B", nousings, "bcode1", new [] { "A", "B", "C", "D" });
            var allDeps = a.AllDependencies;

            Assert.AreEqual(4, allDeps.Count);
            Assert.IsTrue(allDeps.Contains(TypeCode.Get("A")));
            Assert.IsTrue(allDeps.Contains(TypeCode.Get("B")));
            Assert.IsTrue(allDeps.Contains(TypeCode.Get("C")));
            Assert.IsTrue(allDeps.Contains(TypeCode.Get("D")));
        }