Ejemplo n.º 1
0
        public void TestCursor()
        {
            var session = new MockTaskSession();

            session.VerifyStart();

            session.VerifyCommand(() => session.Up(), "Up()");
            session.VerifyCommand(() => session.Down(), "Down()");
            session.VerifyCommand(() => session.Left(), "Left()");
            session.VerifyCommand(() => session.Right(), "Right()");
            session.VerifyCommand(() => session.MoveCursor(0, 0), "MoveCursor(0,0)");
            session.VerifyCommand(() => session.Tab(), "Tab()");
            session.VerifyCommand(() => session.BackTab(), "BackTab()");

            // Force some exceptions.
            Assert.Throws <ArgumentOutOfRangeException>(() => session.MoveCursor(-1, 0));
            Assert.Throws <ArgumentOutOfRangeException>(() => session.MoveCursor(0, -1));

            session.ExceptionMode = true;
            session.AllFail       = true;
            Assert.Throws <X3270ifCommandException>(() => session.Up());
            Assert.Throws <X3270ifCommandException>(() => session.Down());
            Assert.Throws <X3270ifCommandException>(() => session.Left());
            Assert.Throws <X3270ifCommandException>(() => session.Right());
            Assert.Throws <X3270ifCommandException>(() => session.Tab());
            Assert.Throws <X3270ifCommandException>(() => session.BackTab());

            session.Close();
        }