예제 #1
0
        public void Failure_Process_For_Incorrect_File_Lines()
        {
            IntializeMoq();
            fileManager.Setup(x => x.ReadLines(It.IsAny <string>()))
            .Returns(
                BuildOperationResultForTest <string> .OperationGetList
                    (SettingToHandle.InitializeIncorrectReadLines, emptyReadLines, successReadLines));
            var response = handleSellOrder.Execute();

            RobotResponseAnalize.FailureUser(response);
        }
예제 #2
0
        private void IntializeMoq()
        {
            fileManager.Setup(x => x.GetFiles(It.IsAny <string>()))
            .Returns(
                BuildOperationResultForTest <string> .OperationGetList
                    (SettingToHandle.InitializeFileNames, emptyGetFiles, successGetFiles));

            fileManager.Setup(x => x.MoveFile(It.IsAny <string>(), It.IsAny <string>()))
            .Returns(
                successMoveFiles ? new OperationResult(true) : new OperationResult(ErrorDto.BuildTechnical("ERROR")));

            fileManager.Setup(x => x.ReadLines(It.IsAny <string>()))
            .Returns(
                BuildOperationResultForTest <string> .OperationGetList
                    (SettingToHandle.InitializeReadLines, emptyReadLines, successReadLines));

            serialize.Setup(x => x.Execute <IEnumerable <ErrorDto> >(It.IsAny <IEnumerable <ErrorDto> >()))
            .Returns(BuildOperationResultForTest <string> .OperationGetItem
                         (SettingToHandle.InitializeLineErrorList, false, successLineErrorList));

            fileManager.Setup(x => x.CreateFile(It.IsAny <string>(), It.IsAny <IEnumerable <string> >()))
            .Returns(
                new OperationResult(true));

            deserialize.Setup(x => x.Execute <InitialBalanceJsonDto> (It.IsAny <string>()))
            .Returns(BuildOperationResultForTest <InitialBalanceJsonDto> .OperationGetItemThecnical
                         (SettingToHandle.InitializeInitialBalance, successDeserializeInitialBalance));

            deserialize.Setup(x => x.Execute <OrderDto>(It.IsAny <string>()))
            .Returns(BuildOperationResultForTest <OrderDto> .OperationGetItemThecnical
                         (SettingToHandle.InitializeOrderList.FirstOrDefault(), successDeserializeOrderList));

            executionSellOrder.Setup(x => x.Execute(It.IsAny <SellOrdersRequestDto>()))
            .Returns(successExecutionSellOrder ? SettingToHandle.InitializeSellOrderResponse : SettingToHandle.InitializeSellOrderWithErrorResponse);

            serialize.Setup(x => x.Execute <SellOrderResponseDto>(It.IsAny <SellOrderResponseDto>()))
            .Returns(BuildOperationResultForTest <string> .OperationGetItem
                         (SettingToHandle.InitializeSerializeResponse, false, successSerializeResponse));
        }