示例#1
0
        public void NoRecordsShouldReturnSuccessAndLog()
        {
            IMainframeFtp ftp;
            ITransferControlConfigurationManager manager;
            ILog    log;
            IFileIo io;
            ITransferControlRepository mock = CreateMocks(out ftp, out manager, out log, out io);

            MockConfiguration(manager, true);
            mock.Stub(r => r.FindTransferControls(new TransferControlSearchCriteria())).IgnoreArguments().Return(new List <Middleware.Wm.TransferControl.Models.TransferControl>());
            log.Expect(l => l.Info("Inbound: No records to process"));
            Assert.IsTrue(new TransferControlInbound(mock, ftp, manager, log, io).Process());
            log.VerifyAllExpectations();
        }
示例#2
0
        public void ExceptionShouldLogAndReturnFailure()
        {
            IMainframeFtp ftp;
            ITransferControlConfigurationManager manager;
            ILog    log;
            IFileIo io;
            ITransferControlRepository mock = CreateMocks(out ftp, out manager, out log, out io);
            var list2 = new List <Middleware.Wm.TransferControl.Models.TransferControl>();
            var item  = new Middleware.Wm.TransferControl.Models.TransferControl
            {
                BatchControlNumber = "1"
            };

            list2.Add(item);
            List <Middleware.Wm.TransferControl.Models.TransferControl> objToReturn = list2;

            mock.Stub(r => r.FindTransferControls(new TransferControlSearchCriteria())).IgnoreArguments().Return(objToReturn);
            log.Expect(l => l.Exception(Arg <string> .Is.Equal("Inbound : Fatal exception processing batch 1"), Arg <Exception> .Is.Anything));
            ITransferControlInbound inbound = new TransferControlInbound(mock, ftp, manager, log, io);

            Assert.IsFalse(inbound.Process());
            log.VerifyAllExpectations();
        }