示例#1
0
        public void SetUp()
        {
            _voucherRepository = new Mock <IVoucherRepository>();
            _voucherRepository.Setup(x => x.GetVoucherById(It.IsAny <int>())).Returns(() => new Data.Voucher.GetVoucherByIdResponse {
                Voucher = new VoucherRecord {
                    Id = 1
                }
            });

            var subject = new VoucherService(_voucherRepository.Object);

            _result = subject.GetById(1);
        }
示例#2
0
        public void SetUp()
        {
            _voucherRepository = new Mock <IVoucherRepository>();
            _voucherRepository.Setup(x => x.GetVoucherById(It.IsAny <int>())).Returns(() => new Data.Voucher.GetVoucherByIdResponse
            {
                HasError = true,
                Error    = new Error
                {
                    Code = ErrorCodes.DatabaseError
                }
            });

            var subject = new VoucherService(_voucherRepository.Object);

            _result = subject.GetById(1);
        }