Beispiel #1
0
        public TransactBizActionDto Action(TransactBizActionDto dto)
        {
            if (dto.Mode == MockBizActionTransact2Modes.BizErrorPart1)
            {
                AddError("Failed in Part1");
            }

            _context.Authors.Add(new Author {
                Name = "Part1"
            });

            return(dto);
        }
Beispiel #2
0
        public TransactBizActionDto Action(TransactBizActionDto dto)
        {
            if (dto.Mode == MockBizActionTransact2Modes.BizErrorPart2)
            {
                AddError("Failed in Part2");
            }
            if (dto.Mode == MockBizActionTransact2Modes.ThrowExceptionPart2)
            {
                throw new InvalidOperationException("I have thrown an exception.");
            }

            _context.Authors.Add(new Author {
                Name = "Part2"
            });

            return(dto);
        }