示例#1
0
        public void ReturnsCardNetworkEnum_FromString(string validate, CardNetworkEnumerator validation)
        {
            // act
            var validateResult = validate.ToCardNetworkEnumerator();

            // assert
            Assert.AreEqual(validation, validateResult);
        }
示例#2
0
        /// <summary>
        /// Converts a card network enumerator to a human readable title cased string.
        /// </summary>
        /// <param name="network">The card network enumerator.</param>
        /// <returns>Returns a human readble string.</returns>
        public static string ToHuman(this CardNetworkEnumerator network)
        {
            switch (network)
            {
            // manual conversion of the outliers
            case CardNetworkEnumerator.BcaCard: return("BCA Card");

            case CardNetworkEnumerator.BcCard: return("BC Card");

            case CardNetworkEnumerator.EftPos: return("EFT POS");

            case CardNetworkEnumerator.enRoute: return("enRoute");

            case CardNetworkEnumerator.Uatp: return(CardNetworkEnumerator.Uatp.ToString().ToUpper());

            case CardNetworkEnumerator.VPay: return("VPay");

            // auto conversion
            default: return(network.ToString().ToSentenceCase().ToTitleCase());
            }
            ;
        }