コード例 #1
0
        public void ModelFactory_ConvertFrom_RedeemVoucherResponse_IsConverted()
        {
            ModelFactory          modelFactory = new ModelFactory();
            RedeemVoucherResponse model        = TestData.RedeemVoucherResponse;

            DataTransferObjects.RedeemVoucherResponse dto = modelFactory.ConvertFrom(model);

            dto.ShouldNotBeNull();
            dto.ExpiryDate.ShouldBe(model.ExpiryDate);
            dto.VoucherCode.ShouldBe(model.VoucherCode);
            dto.RemainingBalance.ShouldBe(model.RemainingBalance);
        }
コード例 #2
0
        /// <summary>
        /// Converts from.
        /// </summary>
        /// <param name="redeemVoucherResponse">The redeem voucher response.</param>
        /// <returns></returns>
        public RedeemVoucherResponse ConvertFrom(Models.RedeemVoucherResponse redeemVoucherResponse)
        {
            if (redeemVoucherResponse == null)
            {
                return(null);
            }

            RedeemVoucherResponse response = new RedeemVoucherResponse
            {
                ExpiryDate       = redeemVoucherResponse.ExpiryDate,
                VoucherCode      = redeemVoucherResponse.VoucherCode,
                RemainingBalance = redeemVoucherResponse.RemainingBalance
            };

            return(response);
        }