public void TestQuery()
        {
            var session = new MockTaskSession();

            session.VerifyStart();

            session.VerifyCommand(() => session.Query(QueryType.BindPluName), "Query(BindPluName)");

            Assert.AreEqual(session.Query(QueryType.Cursor).Result[0], "0 0");

            // Force an exception.
            session.ExceptionMode = true;
            session.AllFail       = true;
            Assert.Throws <X3270ifCommandException>(() => session.Query(QueryType.Formatted));

            session.Close();

            // Exercise 1-origin.
            session = new MockTaskSession(new MockTaskConfig {
                Origin = 1
            });
            session.Start();
            Assert.AreEqual(session.Query(QueryType.Cursor).Result[0], "1 1");

            // Make sure the history contains the actual value from the emulator.
            Assert.AreEqual(session.RecentCommands[0].Result[0], "0 0");

            session.Close();
        }
        public void TestFullHistory()
        {
            // Start a mock thread session.
            var session     = new MockTaskSession();
            var startResult = session.Start();

            Assert.AreEqual(true, startResult.Success);

            // Make sure the start shows the initial empty command.
            var history = session.RecentCommands;

            Assert.AreEqual(1, history.Length);
            Assert.AreEqual("Query(LocalEncoding)", history[0].Command);

            // Overflow the history list.
            for (int i = 0; i < Session.MaxCommands; i++)
            {
                Assert.AreEqual(true, session.Io("Lines 1").Success);
            }

            history = session.RecentCommands;
            Assert.AreEqual("Lines 1", history[0].Command);
            Assert.AreEqual("Line 1", history[0].Result[0]);

            session.Close();
        }
        public void TestConnect()
        {
            var session = new MockTaskSession();

            session.VerifyStart();

            session.VerifyCommand(() => session.Connect("bob"), "Connect(bob)");
            var logicalUnitList = new[] { "lu1", "lu2" };

            SessionExtensions.VerifyDelegate del =
                () => session.Connect(
                    "bob",
                    "27",
                    logicalUnitList,
                    ConnectFlags.NoLogin);
            session.VerifyCommand(del, "Connect(\"C:lu1,lu2@bob:27\")");

            Assert.Throws <ArgumentException>(() => session.Connect(string.Empty));

            // Force an exception.
            session.ExceptionMode = true;
            session.AllFail       = true;
            Assert.Throws <X3270ifCommandException>(() => session.Connect("foo"));

            session.Close();
        }
        public void TestEbcdic()
        {
            var session = new MockTaskSession();

            session.VerifyStart();

            session.VerifyCommand(() => session.Ebcdic(), "Ebcdic()");
            session.VerifyCommand(() => session.Ebcdic(10), "Ebcdic(10)");
            session.VerifyCommand(() => session.Ebcdic(1, 2, 3), "Ebcdic(1,2,3)");
            session.VerifyCommand(() => session.Ebcdic(1, 2, 3, 4), "Ebcdic(1,2,3,4)");

            Assert.Throws <ArgumentOutOfRangeException>(() => session.Ebcdic(-1, 2, 3));
            Assert.Throws <ArgumentOutOfRangeException>(() => session.Ebcdic(1, -1, 3));
            Assert.Throws <ArgumentOutOfRangeException>(() => session.Ebcdic(-1, 1, 3, 4));
            Assert.Throws <ArgumentOutOfRangeException>(() => session.Ebcdic(1, -1, 3, 4));

            // Force some exceptions.
            session.ExceptionMode = true;
            session.AllFail       = true;
            Assert.Throws <X3270ifCommandException>(() => session.Ebcdic());
            Assert.Throws <X3270ifCommandException>(() => session.Ebcdic(1));
            Assert.Throws <X3270ifCommandException>(() => session.Ebcdic(1, 2, 3));
            Assert.Throws <X3270ifCommandException>(() => session.Ebcdic(1, 2, 3, 4));

            session.Close();
        }
        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();
        }
Esempio n. 6
0
        public void TestAid()
        {
            var session = new MockTaskSession();

            session.VerifyStart();

            session.VerifyCommand(() => session.Enter(), "Enter()");
            session.VerifyCommand(() => session.Clear(), "Clear()");
            session.VerifyCommand(() => session.PF(1), "PF(1)");
            session.VerifyCommand(() => session.PF(2), "PF(2)");
            session.VerifyCommand(() => session.PA(1), "PA(1)");
            session.VerifyCommand(() => session.PA(2), "PA(2)");

            // Force some exceptions.
            Assert.Throws <ArgumentOutOfRangeException>(() => session.PF(0));
            Assert.Throws <ArgumentOutOfRangeException>(() => session.PF(25));
            Assert.Throws <ArgumentOutOfRangeException>(() => session.PA(0));
            Assert.Throws <ArgumentOutOfRangeException>(() => session.PA(4));

            session.ExceptionMode = true;
            session.AllFail       = true;
            Assert.Throws <X3270ifCommandException>(() => session.Enter());
            Assert.Throws <X3270ifCommandException>(() => session.Clear());
            Assert.Throws <X3270ifCommandException>(() => session.PF(1));
            Assert.Throws <X3270ifCommandException>(() => session.PA(1));

            session.Close();
        }
        public void TestTaskMockSession()
        {
            var session     = new MockTaskSession();
            var startResult = session.Start();

            Assert.AreEqual(true, startResult.Success);

            // Test canned responses.
            var result = session.Io("Lines 1");

            Assert.AreEqual(true, result.Success);
            Assert.AreEqual(1, result.Result.Length);
            Assert.AreEqual("Line 1", result.Result[0]);

            result = session.Io("Lines 2");
            Assert.AreEqual(true, result.Success);
            Assert.AreEqual(2, result.Result.Length);
            Assert.AreEqual("Line 1", result.Result[0]);
            Assert.AreEqual("Line 2", result.Result[1]);

            result = session.Io("Fail");
            Assert.AreEqual(false, result.Success);
            Assert.AreEqual(1, result.Result.Length);
            Assert.AreEqual("failed", result.Result[0]);

            // Test a double start.
            Assert.Throws <InvalidOperationException>(() => session.Start());

            // Test the I/O timeout.
            Assert.AreEqual(true, startResult.Success);
            result = session.Io("Hang 100", 50);
            Assert.AreEqual(false, result.Success);
            session.Close();

            // Test the EOF response.
            startResult = session.Start();
            Assert.AreEqual(true, startResult.Success);
            result = session.Io("Quit");
            Assert.AreEqual(false, result.Success);
            Assert.AreEqual(false, session.EmulatorRunning);
            Assert.AreEqual(false, session.LastCommand.Success);
            session.Close();

            // Test the exception for I/O on a closed session.
            Assert.Throws <InvalidOperationException>(() => session.Io("Xxx"));
        }
        public void TestStatusField()
        {
            var session = new MockTaskSession();

            // Test StatusField exception when not running.
            Assert.Throws <InvalidOperationException>(() => session.StatusField(StatusLineField.Formatting));

            var startResult = session.Start();

            Assert.AreEqual(true, startResult.Success);

            // Test ordinary StatusField.
            Assert.AreEqual("F", session.StatusField(StatusLineField.Formatting));

            // Test origin-based StatusField.
            Assert.AreEqual("0", session.StatusField(StatusLineField.CursorRow));
            Assert.AreEqual("0", session.StatusField(StatusLineField.CursorColumn));

            session.Close();

            // Test origin-based StatusField with 1-origin.
            session = new MockTaskSession(new MockTaskConfig {
                Origin = 1
            });
            session.Start();
            Assert.AreEqual("1", session.StatusField(StatusLineField.CursorRow));
            Assert.AreEqual("1", session.StatusField(StatusLineField.CursorColumn));

            // Exercise HostConnected (based on the status line).
            Assert.AreEqual(true, session.HostConnected);

            // Change that.
            session.Connected = false;

            // (Have to run a dummy command to get a new prompt and change state.)
            session.Io("Query()");
            Assert.AreEqual(false, session.HostConnected);

            // Now screen-modifying commands will fail.
            Assert.AreEqual(false, session.Enter().Success);

            // Now exception mode will fire, too.
            session.ExceptionMode = true;
            Assert.Throws <X3270ifCommandException>(() => session.Enter());

            // Try requiring 3270 mode instead.
            session.Config.ModifyFail = ModifyFailType.Require3270;
            Assert.Throws <X3270ifCommandException>(() => session.Enter());

            // And that normally, it's fine.
            session.Connected = true;
            session.Connect("bob");
            Assert.DoesNotThrow(() => session.Enter());

            session.Close();
        }
        public void TestExceptionMode()
        {
            var session     = new MockTaskSession();
            var startResult = session.Start();

            Assert.AreEqual(true, startResult.Success);

            session.ExceptionMode = true;
            Assert.Throws <X3270ifCommandException>(() => session.Io("Fail"));
            Assert.Throws <X3270ifCommandException>(() => session.Io("Fail()"));
            Assert.Throws <X3270ifCommandException>(() => session.Io("Quit"));
            session.Close();
        }
        public void TestCodePage()
        {
            var session = new MockTaskSession();

            session.CodePage = "CP1252";
            Assert.IsTrue(session.Start().Success);

            session.Close();
            session.CodePage = "Junk";
            Assert.IsFalse(session.Start().Success);

            session.CodePage     = null;
            session.CodePageFail = true;
            Assert.IsFalse(session.Start().Success);
        }
        public void TestDisconnect()
        {
            var session = new MockTaskSession();

            session.VerifyStart();

            session.VerifyCommand(() => session.Disconnect(), "Disconnect()");

            // Force an exception.
            session.ExceptionMode = true;
            session.AllFail       = true;
            Assert.Throws <X3270ifCommandException>(() => session.Disconnect());

            session.Close();
        }
        public void TestCursor1()
        {
            var session = new MockTaskSession(new MockTaskConfig {
                Origin = 1
            });

            session.VerifyStart();

            session.VerifyCommand(() => session.MoveCursor(1, 1), "MoveCursor(0,0)");

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

            session.Close();
        }
        public void TestWait()
        {
            var session = new MockTaskSession();

            session.VerifyStart();

            session.VerifyCommand(() => session.Wait(WaitMode.Wait3270Mode), "Wait(3270Mode)");
            session.VerifyCommand(() => session.Wait(WaitMode.Output, 10), "Wait(10,Output)");

            // Force an exception.
            session.ExceptionMode = true;
            session.AllFail       = true;
            Assert.Throws <X3270ifCommandException>(() => session.Wait(WaitMode.Unlock));

            session.Close();
        }
        public void TestEbcdic1()
        {
            var session = new MockTaskSession(new MockTaskConfig {
                Origin = 1
            });

            session.VerifyStart();

            session.VerifyCommand(() => session.Ebcdic(1, 2, 3), "Ebcdic(0,1,3)");
            session.VerifyCommand(() => session.Ebcdic(1, 2, 3, 4), "Ebcdic(0,1,3,4)");

            Assert.Throws <ArgumentOutOfRangeException>(() => session.Ebcdic(0, 2, 3));
            Assert.Throws <ArgumentOutOfRangeException>(() => session.Ebcdic(1, 0, 3));

            session.Close();
        }
        public void TestStringAt()
        {
            var session = new MockTaskSession();

            session.VerifyStart();

            session.VerifyCommand(() => session.StringAt(1, 0, "Fred"), "MoveCursor(1,0) String(Fred)");

            session.VerifyCommand(
                () => session.StringAt(new[]
            {
                new StringAtBlock {
                    Row = 1, Column = 0, Text = "Fred"
                },
                new StringAtBlock {
                    Row = 2, Column = 4, Text = "Smith"
                }
            }),
                "MoveCursor(1,0) String(Fred) MoveCursor(2,4) String(Smith)");

            session.VerifyCommand(
                () => session.StringAt(1, 0, "Fred", eraseEof: true),
                "MoveCursor(1,0) EraseEOF() String(Fred)");

            // Exercise row and column checking.
            Assert.Throws <ArgumentOutOfRangeException>(() => session.StringAt(-1, 0, "foo"));
            Assert.Throws <ArgumentOutOfRangeException>(() => session.StringAt(0, -1, "foo"));

            // Force exceptions.
            session.ExceptionMode = true;
            session.AllFail       = true;
            Assert.Throws <X3270ifCommandException>(() => session.StringAt(1, 0, "foo"));
            Assert.Throws <X3270ifCommandException>(() =>
            {
                var result = session.StringAt(new[]
                {
                    new StringAtBlock {
                        Row = 1, Column = 0, Text = "Fred"
                    },
                    new StringAtBlock {
                        Row = 2, Column = 4, Text = "Smith"
                    }
                });
            });

            session.Close();
        }
        public void TestString()
        {
            var session = new MockTaskSession();

            session.VerifyStart();

            session.VerifyCommand(() => session.String("Fred"), "String(Fred)");
            session.VerifyCommand(() => session.String("a\\b"), "String(\"a\\\\b\")");
            session.VerifyCommand(() => session.String("a\\b", quoteBackslashes: false), "String(\"a\\b\")");

            // Force an exception.
            session.ExceptionMode = true;
            session.AllFail       = true;
            Assert.Throws <X3270ifCommandException>(() => session.String("foo"));

            session.Close();
        }
        public void TestReadBuffer()
        {
            var session = new MockTaskSession();

            session.VerifyStart();

            session.VerifyCommand(() => session.ReadBuffer(), "ReadBuffer(Ascii)");
            session.VerifyCommand(() => session.ReadBuffer(Session.ReadBufferType.Ascii), "ReadBuffer(Ascii)");
            session.VerifyCommand(() => session.ReadBuffer(Session.ReadBufferType.Ebcdic), "ReadBuffer(Ebcdic)");

            // Force an exception.
            session.ExceptionMode = true;
            session.AllFail       = true;
            Assert.Throws <X3270ifCommandException>(() => session.ReadBuffer());

            session.Close();
        }
        public void TestBrokenSession()
        {
            var session = new MockTaskSession();

            session.Start();

            var result = session.Io("Quit");

            Assert.AreEqual(false, result.Success);
            Assert.AreEqual(false, session.EmulatorRunning);

            session.Close();
            session.Start();
            result = session.Io("ReplyQuit");
            Assert.AreEqual(true, result.Success);
            Thread.Sleep(500);
            result = session.Io("Anything");
            Assert.AreEqual(false, result.Success);
            Assert.AreEqual(false, session.EmulatorRunning);
        }
        public void TestTransfer()
        {
            var session = new MockTaskSession();

            session.VerifyStart();

            // Basic functionality.
            session.VerifyCommand(
                () => session.Transfer(
                    @"C:\foo.txt",
                    "FOO TXT A",
                    Direction.Send,
                    Mode.Ascii,
                    HostType.Vm,
                    new ParameterExistAction(ExistAction.Replace)),
                "Transfer(direction=Send,exist=Replace,host=Vm,\"hostfile=FOO TXT A\",\"localfile=C:\\\\foo.txt\",mode=Ascii)");

            // Bad parameter type.
            Assert.Throws <ArgumentException>(
                () => session.Transfer("foo.txt", "foo txt a", Direction.Send, Mode.Ascii, HostType.Vm, "wrong!"));
            Assert.Throws <ArgumentNullException>(
                () => session.Transfer(
                    "foo.txt",
                    "foo txt a",
                    Direction.Send,
                    Mode.Ascii,
                    HostType.Vm,
                    new ParameterExistAction(ExistAction.Replace),
                    null));

            // Bad file names.
            Assert.Throws <ArgumentException>(
                () => session.Transfer(string.Empty, "foo txt a", Direction.Send, Mode.Ascii, HostType.Vm));
            Assert.Throws <ArgumentException>(
                () => session.Transfer(null, "foo txt a", Direction.Send, Mode.Ascii, HostType.Vm));
            Assert.Throws <ArgumentException>(
                () => session.Transfer("foo.txt", string.Empty, Direction.Send, Mode.Ascii, HostType.Vm));
            Assert.Throws <ArgumentException>(
                () => session.Transfer("foo.txt", null, Direction.Send, Mode.Ascii, HostType.Vm));

            // Bad AsciiRemap.
            Assert.Throws <ArgumentException>(() => new ParameterAsciiRemap(false, 252));
            Assert.Throws <ArgumentOutOfRangeException>(() => new ParameterAsciiRemap(true, 0));

            // Bad block size.
            Assert.Throws <ArgumentOutOfRangeException>(() => new ParameterBlockSize(0));

            // Bad logical record length.
            Assert.Throws <ArgumentOutOfRangeException>(() => new ParameterSendLogicalRecordLength(0));

            // Bad TsoSendAllocations.
            Assert.Throws <ArgumentOutOfRangeException>(() => new ParameterTsoSendAllocation(TsoAllocationUnits.Cylinders, 0));
            Assert.Throws <ArgumentOutOfRangeException>(() => new ParameterTsoSendAllocation(TsoAllocationUnits.Cylinders, 100, 0));
            Assert.Throws <ArgumentException>(() => new ParameterTsoSendAllocation(TsoAllocationUnits.Avblock, 100, 200));
            Assert.Throws <ArgumentOutOfRangeException>(() => new ParameterTsoSendAllocation(TsoAllocationUnits.Avblock, 100, 200, 0));
            Assert.Throws <ArgumentException>(() => new ParameterTsoSendAllocation(TsoAllocationUnits.Cylinders, 100, 200, 300));

            // Bad buffer size.
            Assert.Throws <ArgumentOutOfRangeException>(() => new ParameterBufferSize(0));

            // All possible options.
            session.VerifyCommand(
                () => session.Transfer(
                    @"C:\foo.txt",
                    "FOO TXT A",
                    Direction.Send,
                    Mode.Ascii,
                    HostType.Tso,
                    new ParameterAsciiCr(false),
                    new ParameterAsciiRemap(true, 252),
                    new ParameterExistAction(ExistAction.Replace),
                    new ParameterSendRecordFormat(RecordFormat.Fixed),
                    new ParameterSendLogicalRecordLength(80),
                    new ParameterBlockSize(1024),
                    new ParameterTsoSendAllocation(TsoAllocationUnits.Avblock, 100, 200, 300),
                    new ParameterBufferSize(4096)),
                "Transfer(allocation=Avblock,avblock=300,blocksize=1024,buffersize=4096,cr=keep,direction=Send,exist=Replace,host=Tso,\"hostfile=FOO TXT A\",\"localfile=C:\\\\foo.txt\",lrecl=80,mode=Ascii,primaryspace=100,recfm=Fixed,remap=yes,secondaryspace=200,windowscodepage=252)");

            // Some ASCII option variations.
            session.VerifyCommand(
                () =>
            {
                return(session.Transfer(
                           @"C:\foo.txt",
                           "FOO TXT A",
                           Direction.Send,
                           Mode.Ascii,
                           HostType.Tso,
                           new ParameterAsciiCr(true),
                           new ParameterAsciiRemap(false)));
            },
                "Transfer(cr=add,direction=Send,host=Tso,\"hostfile=FOO TXT A\",\"localfile=C:\\\\foo.txt\",mode=Ascii,remap=no)");

            // Same thing, using the IEnumerable API.
            session.VerifyCommand(
                () =>
            {
                return(session.Transfer(
                           @"C:\foo.txt",
                           "FOO TXT A",
                           Direction.Send,
                           Mode.Ascii,
                           HostType.Tso,
                           new List <Parameter>
                {
                    new ParameterAsciiCr(true),
                    new ParameterAsciiRemap(false)
                }));
            },
                "Transfer(cr=add,direction=Send,host=Tso,\"hostfile=FOO TXT A\",\"localfile=C:\\\\foo.txt\",mode=Ascii,remap=no)");

            // AsciiCr without Ascii.
            Assert.Throws <ArgumentException>(
                () =>
            {
                var result = session.Transfer(
                    "foo.txt",
                    "FOO.TXT",
                    Direction.Receive,
                    Mode.Binary,
                    HostType.Tso,
                    new ParameterAsciiCr(true));
            });

            // Same thing, using the IEnumerable API.
            Assert.Throws <ArgumentException>(
                () =>
            {
                var result = session.Transfer(
                    "foo.txt",
                    "FOO.TXT",
                    Direction.Receive,
                    Mode.Binary,
                    HostType.Tso,
                    new List <Parameter> {
                    new ParameterAsciiCr(true)
                });
            });

            // AsciiRemap without Ascii.
            Assert.Throws <ArgumentException>(
                () =>
            {
                var result = session.Transfer(
                    "foo.txt",
                    "FOO.TXT",
                    Direction.Receive,
                    Mode.Binary,
                    HostType.Tso,
                    new ParameterAsciiRemap(true));
            });

            // Lrecl without send.
            Assert.Throws <ArgumentException>(
                () =>
            {
                var result = session.Transfer(
                    "foo.txt",
                    "FOO.TXT",
                    Direction.Receive,
                    Mode.Binary,
                    HostType.Tso,
                    new ParameterSendLogicalRecordLength(80));
            });

            // Lrecl on CICS.
            Assert.Throws <ArgumentException>(
                () =>
            {
                var result = session.Transfer(
                    "foo.txt",
                    "FOO.TXT",
                    Direction.Send,
                    Mode.Binary,
                    HostType.Cics,
                    new ParameterSendLogicalRecordLength(80));
            });

            // Recfm without send.
            Assert.Throws <ArgumentException>(
                () =>
            {
                var result = session.Transfer(
                    "foo.txt",
                    "FOO.TXT",
                    Direction.Receive,
                    Mode.Binary,
                    HostType.Tso,
                    new ParameterSendRecordFormat(RecordFormat.Fixed));
            });

            // Recfm on CICS.
            Assert.Throws <ArgumentException>(
                () =>
            {
                var result = session.Transfer(
                    "foo.txt",
                    "FOO.TXT",
                    Direction.Send,
                    Mode.Binary,
                    HostType.Cics,
                    new ParameterSendRecordFormat(RecordFormat.Fixed));
            });

            // TSO allocation without send.
            Assert.Throws <ArgumentException>(
                () =>
            {
                var result = session.Transfer(
                    "foo.txt",
                    "FOO.TXT",
                    Direction.Receive,
                    Mode.Binary,
                    HostType.Tso,
                    new ParameterTsoSendAllocation(TsoAllocationUnits.Cylinders, 100));
            });

            // TSO allocation on non-TSO.
            Assert.Throws <ArgumentException>(
                () =>
            {
                var result = session.Transfer(
                    "foo.txt",
                    "FOO.TXT",
                    Direction.Send,
                    Mode.Binary,
                    HostType.Vm,
                    new ParameterTsoSendAllocation(TsoAllocationUnits.Cylinders, 100));
            });

            // Append with recfm.
            Assert.Throws <ArgumentException>(
                () =>
            {
                var result = session.Transfer(
                    "foo.txt",
                    "FOO.TXT",
                    Direction.Send,
                    Mode.Binary,
                    HostType.Tso,
                    new ParameterExistAction(ExistAction.Append),
                    new ParameterSendRecordFormat(RecordFormat.Fixed));
            });

            // Append with lrecl.
            Assert.Throws <ArgumentException>(
                () =>
            {
                var result = session.Transfer(
                    "foo.txt",
                    "FOO.TXT",
                    Direction.Send,
                    Mode.Binary,
                    HostType.Tso,
                    new ParameterExistAction(ExistAction.Append),
                    new ParameterSendLogicalRecordLength(80));
            });

            // Append with TSO allocation.
            Assert.Throws <ArgumentException>(
                () =>
            {
                var result = session.Transfer(
                    "foo.txt",
                    "FOO.TXT",
                    Direction.Send,
                    Mode.Binary,
                    HostType.Tso,
                    new ParameterExistAction(ExistAction.Append),
                    new ParameterTsoSendAllocation(TsoAllocationUnits.Cylinders, 100));
            });

            // Blocksize without TSO.
            Assert.Throws <ArgumentException>(
                () =>
            {
                var result = session.Transfer(
                    "foo.txt",
                    "FOO.TXT",
                    Direction.Send,
                    Mode.Binary,
                    HostType.Cics,
                    new ParameterBlockSize(1024));
            });
            Assert.Throws <ArgumentException>(
                () =>
            {
                var result = session.Transfer(
                    "foo.txt",
                    "FOO.TXT",
                    Direction.Send,
                    Mode.Binary,
                    HostType.Vm,
                    new ParameterBlockSize(1024));
            });

            session.Close();
        }