Beispiel #1
0
        public void ModelFactory_ConvertFrom_RedeemVoucherResponse_NullInput_IsConverted()
        {
            ModelFactory         modelFactory = new ModelFactory();
            IssueVoucherResponse model        = null;

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

            dto.ShouldBeNull();
        }
Beispiel #2
0
        public void ModelFactory_ConvertFrom_IssueVoucherResponse_IsConverted()
        {
            ModelFactory         modelFactory = new ModelFactory();
            IssueVoucherResponse model        = TestData.IssueVoucherResponse;

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

            dto.ShouldNotBeNull();
            dto.ExpiryDate.ShouldBe(model.ExpiryDate);
            dto.Message.ShouldBe(model.Message);
            dto.VoucherCode.ShouldBe(model.VoucherCode);
            dto.VoucherId.ShouldBe(model.VoucherId);
        }
        /// <summary>
        /// Converts from.
        /// </summary>
        /// <param name="issueVoucherResponse">The issue voucher response.</param>
        /// <returns></returns>
        public IssueVoucherResponse ConvertFrom(Models.IssueVoucherResponse issueVoucherResponse)
        {
            if (issueVoucherResponse == null)
            {
                return(null);
            }

            IssueVoucherResponse response = new IssueVoucherResponse
            {
                Message     = issueVoucherResponse.Message,
                ExpiryDate  = issueVoucherResponse.ExpiryDate,
                VoucherCode = issueVoucherResponse.VoucherCode,
                VoucherId   = issueVoucherResponse.VoucherId
            };

            return(response);
        }