Пример #1
0
        public void MissingFormatSpecific_UseToString_Option()
        {
            // Arrange
            FormatterContainer formatter = FormatterContainer.Create(config =>
            {
                config.MissingFormatSpecific = MissingFormatSpecificHandling.UseToString;
            });
            var input = new TestClassWithoutFormatSpecific("anything");

            // Act
            string result = formatter.For <TestClassWithoutFormatSpecific>().Format(input, null);

            // Assert
            Assert.That(result, Is.EqualTo("anything"));
        }
Пример #2
0
        public void MissingFormatSpecific_ThrowNotSupportedException_Option()
        {
            // Arrange
            FormatterContainer formatter = FormatterContainer.Create(config =>
            {
                config.MissingFormatSpecific = MissingFormatSpecificHandling.ThrowNotSupportedException;
            });
            var input = new TestClassWithoutFormatSpecific("anything");

            // Act
            TestDelegate test = () => formatter.For <TestClassWithoutFormatSpecific>().Format(input, null);

            // Assert
            Assert.That(test, Throws.TypeOf <NotSupportedException>());
        }