public void EnumTransferTaskThreeEntriesThreeChunks() { _transferReply.Body.transferTaskList = new PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskList(); _transferReply.Body.transferTaskList.Add(_transferTask1); _transferReply.Body.transferTaskList.Add(_transferTask2); _transferReply.Body.transferTaskList.Add(_transferTask3); _transferReply.Body.endOfEnum = false; var transferReplyPart2 = new PIS.Ground.Core.T2G.WebServices.FileTransfer.enumTransferTaskOutput(); transferReplyPart2.Body = new PIS.Ground.Core.T2G.WebServices.FileTransfer.enumTransferTaskOutputBody(); transferReplyPart2.Body.transferTaskList = new PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskList(); transferReplyPart2.Body.transferTaskList.Add(_transferTask4); transferReplyPart2.Body.transferTaskList.Add(_transferTask5); transferReplyPart2.Body.transferTaskList.Add(_transferTask6); transferReplyPart2.Body.endOfEnum = false; var transferReplyPart3 = new PIS.Ground.Core.T2G.WebServices.FileTransfer.enumTransferTaskOutput(); transferReplyPart3.Body = new PIS.Ground.Core.T2G.WebServices.FileTransfer.enumTransferTaskOutputBody(); transferReplyPart3.Body.transferTaskList = new PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskList(); transferReplyPart3.Body.transferTaskList.Add(_transferTask7); transferReplyPart3.Body.transferTaskList.Add(_transferTask8); transferReplyPart3.Body.endOfEnum = true; var expectedTaskList = new PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskList(); expectedTaskList.AddRange(_transferReply.Body.transferTaskList); expectedTaskList.AddRange(transferReplyPart2.Body.transferTaskList); expectedTaskList.AddRange(transferReplyPart3.Body.transferTaskList); var transferList = new List <PIS.Ground.Core.T2G.WebServices.FileTransfer.enumTransferTaskOutput>(); transferList.Add(_transferReply); transferList.Add(transferReplyPart2); transferList.Add(transferReplyPart3); ushort currentTransferListIndex = 0; _fileTransferPortMock.Setup(x => x.enumTransferTask( It.IsAny <PIS.Ground.Core.T2G.WebServices.FileTransfer.enumTransferTaskInput>())) .Throws(new Exception("Invalid invocation")); _fileTransferPortMock.Setup(x => x.enumTransferTask( It.Is <PIS.Ground.Core.T2G.WebServices.FileTransfer.enumTransferTaskInput>( t => t.Body.enumPos < transferList.Count && t.Body.enumPos == currentTransferListIndex && t.Body.startDate == _startTransferDate && t.Body.endDate == _endTransferDate))) .Returns(() => transferList[currentTransferListIndex++]); PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskList taskListResult; bool lSuccess = _t2gFileDistMgr.EnumTransferTask(_startTransferDate, _endTransferDate, out taskListResult); _fileTransferPortMock.Verify(x => x.enumTransferTask( It.Is <PIS.Ground.Core.T2G.WebServices.FileTransfer.enumTransferTaskInput> (l => l.Body.startDate == _startTransferDate && l.Body.endDate == _endTransferDate)), Times.Exactly(3)); Assert.IsTrue(lSuccess, "EnumTransferTask didn't succeed as expected"); Assert.IsTrue(CompareTaskLists(expectedTaskList, taskListResult)); }
public void EnumTransferTaskThreeEntriesEmptyFirstChunk() { _transferReply.Body.transferTaskList = new PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskList(); _transferReply.Body.endOfEnum = false; var transferReplyPart2 = new PIS.Ground.Core.T2G.WebServices.FileTransfer.enumTransferTaskOutput(); transferReplyPart2.Body = new PIS.Ground.Core.T2G.WebServices.FileTransfer.enumTransferTaskOutputBody(); transferReplyPart2.Body.transferTaskList = new PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskList(); transferReplyPart2.Body.transferTaskList.Add(_transferTask1); transferReplyPart2.Body.transferTaskList.Add(_transferTask2); transferReplyPart2.Body.transferTaskList.Add(_transferTask3); transferReplyPart2.Body.endOfEnum = true; var expectedTaskList = new PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskList(); expectedTaskList.AddRange(_transferReply.Body.transferTaskList); expectedTaskList.AddRange(transferReplyPart2.Body.transferTaskList); var transferList = new List <PIS.Ground.Core.T2G.WebServices.FileTransfer.enumTransferTaskOutput>(); transferList.Add(_transferReply); transferList.Add(transferReplyPart2); var currentTransferListIndex = 0; _fileTransferPortMock.Setup(x => x.enumTransferTask( It.IsAny <PIS.Ground.Core.T2G.WebServices.FileTransfer.enumTransferTaskInput>())) .Returns(() => transferList[currentTransferListIndex++]); PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskList taskListResult; bool lSuccess = _t2gFileDistMgr.EnumTransferTask(_startTransferDate, _endTransferDate, out taskListResult); _fileTransferPortMock.Verify(x => x.enumTransferTask( It.Is <PIS.Ground.Core.T2G.WebServices.FileTransfer.enumTransferTaskInput> (l => l.Body.startDate == _startTransferDate && l.Body.endDate == _endTransferDate)), Times.Exactly(2)); Assert.IsTrue(CompareTaskLists(expectedTaskList, taskListResult)); Assert.IsTrue(lSuccess); }