/// <summary> /// Converts a PayeeType value to a corresponding string value /// </summary> /// <param name="enumValue">The PayeeType value to convert</param> /// <returns>The representative string value</returns> public static string ToValue(PayeeType enumValue) { switch (enumValue) { //only valid enum elements can be used //this is necessary to avoid errors case PayeeType.BUSINESS: case PayeeType.INDIVIDUAL: return(StringValues[(int)enumValue]); //an invalid enum value was requested default: return(null); } }
public async Task Can_get_form_with_available_payee_types() { var payeeType = new PayeeType { Id = 1, Name = "Foo" }; var query = new PayeeEditorFormQuery(); payeeTypes.All.Returns(new [] { payeeType }.AsEnumerable()); var result = await handler.Handle(query); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(PayeeEditorForm)); Assert.IsTrue(result.AvailableTypes.Any(a => a.Id == payeeType.Id)); Assert.IsNull(result.PayeeId); }
/// <inheritdoc/> public string ToDelimitedString() { CultureInfo culture = CultureInfo.CurrentCulture; return(string.Format( culture, StringHelper.StringFormatSequence(0, 8, Configuration.FieldSeparator), Id, SetIdPye.HasValue ? SetIdPye.Value.ToString(culture) : null, PayeeType?.ToDelimitedString(), PayeeRelationshipToInvoicePatient?.ToDelimitedString(), PayeeIdentificationList?.ToDelimitedString(), PayeePersonName?.ToDelimitedString(), PayeeAddress?.ToDelimitedString(), PaymentMethod?.ToDelimitedString() ).TrimEnd(Configuration.FieldSeparator.ToCharArray())); }
public static void SeedPayee(AppDbContext db, String[] account) { PayeeType type = (PayeeType)Enum.Parse(typeof(PayeeType), account[1], true); var recipient = new Payee() { Name = account[0].ToString(), PayeeType = type, Street = account[2].ToString(), City = account[3].ToString(), State = account[4].ToString(), Zipcode = account[5].ToString(), PhoneNumber = account[6].ToString() }; db.Payees.AddOrUpdate(a => a.PayeeID, recipient); db.SaveChanges(); }
public async Task Payee_not_found() { var payeeId = 42; var payeeType = new PayeeType { Id = 1, Name = "Foo" }; var query = new PayeeEditorFormQuery(payeeId: payeeId); payeeTypes.All.Returns(new[] { payeeType }.AsEnumerable()); payees.GetById(Arg.Is(payeeId)) .Returns(Enumerable.Empty <Payee>().AsAsyncQueryable()); var result = await handler.Handle(query); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(PayeeEditorForm)); Assert.IsTrue(result.AvailableTypes.Any(a => a.Id == payeeType.Id)); handler.Logger.Received().Warn(Arg.Any <string>(), payeeId); }
public async Task Can_get_form_for_payee() { var payeeId = 42; var payee = new Payee { Id = payeeId }; var payeeType = new PayeeType { Id = 1, Name = "Foo" }; var query = new PayeeEditorFormQuery(payeeId: payeeId); payeeTypes.All.Returns(new[] { payeeType }.AsEnumerable()); payees.GetById(Arg.Is(payeeId)) .Returns(new[] { payee }.AsAsyncQueryable()); var result = await handler.Handle(query); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(PayeeEditorForm)); Assert.IsTrue(result.AvailableTypes.Any(a => a.Id == payeeType.Id)); Assert.AreEqual(result.PayeeId, payee.Id); }