Exemplo n.º 1
0
        public void Test_Format()
        {
            var stringMessageFormatter = new StringMessageFormatter();

            string expected = string.Format(@"Test_Format
Local time:{0}
UTC time:{1}", DateTime.Now.ToString(System.Globalization.CultureInfo.InstalledUICulture), DateTime.UtcNow.ToString(System.Globalization.CultureInfo.InstalledUICulture));

            Assert.AreEqual(expected, stringMessageFormatter.Format("Test_Format", null));
        }
Exemplo n.º 2
0
        public void Test_Format_Exception()
        {
            var       stringMessageFormatter = new StringMessageFormatter();
            Exception ex       = new Exception("Exception message");
            string    expected = string.Format(@"Test_Format_Exception
Local time:{0}
UTC time:{1}
Exception information:
Exception type: {2}
Exception message: {3}
Source: 
Stack trace: ", DateTime.Now.ToString(System.Globalization.CultureInfo.InstalledUICulture), DateTime.UtcNow.ToString(System.Globalization.CultureInfo.InstalledUICulture), ex.GetType(), ex.Message);

            Assert.AreEqual(expected, stringMessageFormatter.Format("Test_Format_Exception", ex));
        }