示例#1
0
        public static void TestCreation()
        {
            var b = new Base(null, string.Empty);
                        var a = new Base(b, string.Empty);

                        Assert.AreEqual(a.HasRunner, false);
                        Assert.AreEqual(b.HasRunner, false);
                        Assert.AreEqual(a.Advance(), false);
                        Assert.AreEqual(b.Advance(), false);
                        Assert.AreEqual(a.Out(), false);
                        Assert.AreEqual(b.Out(), false);
        }
示例#2
0
        public static void TestRunners()
        {
            var b = new Base(null, string.Empty);
                        var a = new Base(b, string.Empty);

                        a.Land();
                        Assert.AreEqual(a.HasRunner, true);
                        Assert.AreEqual(b.HasRunner, false);

                        Assert.AreEqual(b.Advance(), false);
                        Assert.AreEqual(a.Advance(), true);
                        Assert.AreEqual(a.HasRunner, false);
                        Assert.AreEqual(b.HasRunner, true);

                        Assert.AreEqual(a.Advance(), false);
                        Assert.AreEqual(b.Advance(), true);
                        Assert.AreEqual(a.HasRunner, false);
                        Assert.AreEqual(b.HasRunner, false);

                        a.Error();
                        Assert.AreEqual(a.HasRunner, true);
                        Assert.AreEqual(b.HasRunner, false);

                        Assert.AreEqual(a.Out(), true);
                        Assert.AreEqual(a.Out(), false);
                        a.Land();
                        Assert.AreEqual(a.Out(), true);
                        Assert.AreEqual(a.Out(), false);

                        a.Land();
                        Assert.AreEqual(a.HasRunner, true);
                        Assert.AreEqual(b.HasRunner, false);
                        a.Clear();
                        Assert.AreEqual(a.HasRunner, false);
                        Assert.AreEqual(b.HasRunner, false);
        }
示例#3
0
        public static void TestHome()
        {
            bool success = false;
                        var b = new Base(null, string.Empty);
                        var a = new Base(b, string.Empty);

                        b.SetRun(() => success = true);
                        Assert.AreEqual(success, false);

                        b.Land();
                        Assert.AreEqual(success, true);
                        Assert.AreEqual(b.HasRunner, false);

                        success = false;
                        a.Land();
                        Assert.AreEqual(success, false);
                        a.Advance();
                        Assert.AreEqual(success, true);
        }