Exemple #1
0
        public void CustomersToString_NSInFormat_ThrowsFormatException(string format)
        {
            var c = new Customer("John Doe", "+1 (425) 555-0100", 1000.52m);
            var customFormatProvider = new ShortNameFormatProvider();

            Assert.Throws <FormatException>(() => string.Format(customFormatProvider, $"{{0:{format}}}", c));
        }
Exemple #2
0
        public string CustomersToString_ValidInputInvariantCulture_ValidString(string name, string format)
        {
            var c = new Customer(name, "+1 (425) 555-0100", 1000.52m);
            var customFormatProvider = new ShortNameFormatProvider();

            return(string.Format(customFormatProvider, $"{{0:{format}}}", c));
        }