Esempio n. 1
0
 public void LogValues_With_UnbalancedBraces(string format)
 {
     Assert.Throws<FormatException>(() =>
     {
         var logValues = new FormattedLogValues(format);
         logValues.Format();
     });
 }
Esempio n. 2
0
        public void LogValues_With_Basic_Types(string expected, string format, object[] args)
        {
            var logValues = new FormattedLogValues(format, args);
            Assert.Equal(expected, logValues.Format());

            // Original format is expected to be returned from GetValues.
            Assert.Equal(format, logValues.GetValues().First(v => v.Key == "{OriginalFormat}").Value);
        }
Esempio n. 3
0
        public void LogValues_With_DateTime(string expected, string format)
        {
            var dateTime = new DateTime(2015, 1, 1, 1, 1, 1);
            var logValues = new FormattedLogValues(format, new object[] { dateTime, dateTime });
            Assert.Equal(expected, logValues.Format());

            // Original format is expected to be returned from GetValues.
            Assert.Equal(format, logValues.GetValues().First(v => v.Key == "{OriginalFormat}").Value);
        }
Esempio n. 4
0
        public void FormatsEnumerableValues(string messageFormat, object[] arguments, string expected)
        {
            var logValues = new FormattedLogValues(messageFormat, arguments);

            Assert.Equal(expected, logValues.ToString());
        }