public void SetUp() { _voucherRepository = new Mock <IVoucherRepository>(); _voucherRepository.Setup(x => x.GetAllVouchers()).Returns(() => new Data.Voucher.GetAllVouchersResponse { VoucherDetails = new List <VoucherDetails> { new VoucherDetails { Voucher = new VoucherRecord { Id = 1, Code = "SOME_VOUCHER_CODE", Price = "1200", Quantity = 2, OnlyNamed = true, Title = "AWESOME DEAL" }, AllowedSizes = new List <VoucherSizeRecord> { new VoucherSizeRecord { Id = 1, Voucher = new VoucherRecord { Id = 1 }, Size = new SizeRecord { Id = 1 } } }, AllowedDeliveryTypes = new List <VoucherDeliveryTypeRecord> { new VoucherDeliveryTypeRecord { Id = 1, Voucher = new VoucherRecord { Id = 1 }, DeliveryType = new DeliveryTypeRecord { Id = 1 } } } } } }); var subject = new VoucherService(_voucherRepository.Object); _result = subject.GetAll(); }
public void SetUp() { _voucherRepository = new Mock <IVoucherRepository>(); _voucherRepository.Setup(x => x.GetAllVouchers()).Returns(() => new Data.Voucher.GetAllVouchersResponse { HasError = true, Error = new Error { Code = ErrorCodes.DatabaseError } }); var subject = new VoucherService(_voucherRepository.Object); _result = subject.GetAll(); }