public void ToString_Format_Exception(string format, string provider)
        {
            if (provider != null)
            {
                formatProvider = new CultureInfo(provider);
            }

            CustomFormatProvider customFormatProvider = new CustomFormatProvider(formatProvider);

            Assert.That(() => customFormatProvider.Format(format, customer, formatProvider), Throws.TypeOf <FormatException>());
        }
        public string ToString_Format_CustomerFormatProvider(string format, string provider)
        {
            if (provider != null)
            {
                formatProvider = new CultureInfo(provider);
            }

            CustomFormatProvider customFormatProvider = new CustomFormatProvider(formatProvider);

            return(customFormatProvider.Format(format, customer, formatProvider));
        }
        public void TitleYearRepresentationTest__BookInstance_String()
        {
            Book book = new Book()
            {
                Title           = "C# in Depth",
                Author          = "Jon Skeet",
                Year            = 2019,
                PublishingHouse = "Manning",
                Edition         = 4,
                Pages           = 900,
                Price           = 40
            };

            string          expected = "C# in Depth, 2019";
            IFormatProvider te       = new CustomFormatProvider();
            string          actual   = string.Format(te, "{0:TE}", book);

            Assert.AreEqual(expected, actual);
        }