コード例 #1
0
        public void TestGetColumn()
        {
            Project p = new Project(Whee.WordBuilder.Helpers.Random.Instance);
            Context c = new Context();

            c.Tokens.Add("a");
            c.Tokens.Add("b");
            c.Tokens.Add("c");

            Assert.AreEqual("abc", c.GetColumn("", p));

            c.Mark("m1", "m1");

            Assert.AreEqual("m1", c.GetColumn("!m1", p));

            Context branch = c.Branch("b1");

            branch.Tokens.Add("d");

            Assert.AreEqual("abcd", c.GetColumn("b1", p));

            branch.Mark("m2", "m2");
            Assert.AreEqual("m2", c.GetColumn("b1.!m2", p));

            Context branch2 = branch.Branch("b2");

            branch2.Tokens.Add("e");

            Assert.AreEqual("abcde", c.GetColumn("b1.b2", p));
        }
コード例 #2
0
        public void TestDescription()
        {
            Context c = new Context();

            c.Tokens.Add("a");
            c.Tokens.Add("b");
            c.Tokens.Add("c");

            Assert.AreEqual("abc", c.Description(""));

            c.Mark("m1", "m1");

            Assert.AreEqual(String.Format("abc{0}m1: m1", Environment.NewLine), c.Description(""));

            Context branch = c.Branch("b1");

            branch.Tokens.Add("d");

            Assert.AreEqual(String.Format("abc{0}m1: m1{0}\tb1: abcd", Environment.NewLine), c.Description(""));

            branch.Mark("m2", "m2");
            Assert.AreEqual(String.Format("abc{0}m1: m1{0}\tb1: abcd{0}\tm2: m2", Environment.NewLine), c.Description(""));
        }