public void Init() { TypeCode.Clear(); var a = TypeCode.Set("A", nousings, "acode1", nodeps); Assert.IsFalse(a.CodeChanged); }
public void ZeroUsingsNoNamespace() { TypeCode.Clear(); var a = TypeCode.Set("A", nousings, "acode1", nodeps, ""); var lib = a.GetLinkedCode(); Assert.AreEqual("\nacode1", lib.Declarations); }
public void NoDeps() { TypeCode.Clear(); var a = TypeCode.Set("A", nousings, "acode1", nodeps); var lib = a.GetLinkedCode(); Assert.AreEqual(1, lib.Types.Length); }
public void Changed() { TypeCode.Clear(); var a = TypeCode.Set("A", nousings, "acode1", nodeps); TypeCode.Set("A", nousings, "acode2", nodeps); Assert.IsTrue(a.CodeChanged); }
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); }
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)); }
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)); }
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); }
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"))); }
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); }
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); }
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"))); }