Example #1
0
            public void GivenTheFollowingVouchersHaveBeenIssued(Table table)
            {
                foreach (TableRow tableRow in table.Rows)
                {
                    //| VoucherCode | VoucherValue | RecipientEmail                 | RecipientMobile |
                    String  voucherCode     = SpecflowTableHelper.GetStringRowValue(tableRow, "VoucherCode");
                    Decimal voucherValue    = SpecflowTableHelper.GetDecimalValue(tableRow, "VoucherValue");
                    String  recipientEmail  = String.IsNullOrEmpty(SpecflowTableHelper.GetStringRowValue(tableRow, "RecipientEmail")) ? null : SpecflowTableHelper.GetStringRowValue(tableRow, "RecipientEmail");
                    String  recipientMobile = String.IsNullOrEmpty(SpecflowTableHelper.GetStringRowValue(tableRow, "RecipientMobile")) ? null : SpecflowTableHelper.GetStringRowValue(tableRow, "RecipientMobile");

                    Voucher voucher = new Voucher
                    {
                        Balance           = voucherValue,
                        Barcode           = String.Empty,         // TODO: Generate a barcode
                        EstateId          = Guid.Parse("347C8CD4-A194-4115-A36F-A75A5E24C49B"),
                        ContractId        = Guid.Parse("FC3E5F36-54AA-4BA2-8BF8-5391ACE4BD4B"),
                        ExpiryDate        = DateTime.Now.AddDays(30),
                        GeneratedDateTime = DateTime.Now,
                        IsGenerated       = true,
                        IsIssued          = true,
                        IsRedeemed        = false,
                        IssuedDateTime    = DateTime.Now.AddSeconds(5),
                        Message           = String.Empty,
                        RecipientEmail    = recipientEmail,
                        RecipientMobile   = recipientMobile,
                        RedeemedDateTime  = DateTime.MinValue,
                        TransactionId     = Guid.NewGuid(),
                        Value             = voucherValue,
                        VoucherCode       = voucherCode,
                        VoucherId         = Guid.NewGuid()
                    };

                    String voucherData = JsonConvert.SerializeObject(voucher);

                    AppManager.AddTestVoucher(voucherData);
                    this.TestingContext.Vouchers.Add(voucher);
                }
            }