public void CreateFormatterTrivialTest() { var formatterFactory = new FormatterSimpleFactory(null); FormatterSimpleFactory.Formatter formatterNull = formatterFactory.CreateFormatter(null); FormatterSimpleFactory.Formatter formatterNotExists = formatterFactory.CreateFormatter("not existing formatter name asdfasdf"); Assert.IsTrue(formatterNull == formatterFactory.DefaultFormatter); Assert.IsTrue(formatterNotExists == formatterFactory.DefaultFormatter); }
public void CreateFormatterLowercaseTest() { string message = "some asdf random ;lkj message"; var date = new DateTime(1993, 03, 11, 2, 25, 35); var formatterFactory = new FormatterSimpleFactory(); FormatterSimpleFactory.Formatter formatter = formatterFactory.CreateFormatter("Lowercase"); string formatted = formatter(new Message(message, null, true, date)); Assert.AreEqual(formatted, "some asdf random ;lkj message"); }
public void CreateFormatterStartWithDateTest() { string message = "some asdf random ;lkj message"; var date = new DateTime(1993, 03, 11, 2, 25, 35); var formatterFactory = new FormatterSimpleFactory(); FormatterSimpleFactory.Formatter formatter = formatterFactory.CreateFormatter("Start with DateTime"); string formatted = formatter(new Message(message, null, true, date)); Assert.AreEqual(formatted, "[03/11/1993 02:25:35] some asdf random ;lkj message"); }
public void CreateFormatterUppercase() { string message = "some asdf random ;lkj message"; var date = new DateTime(1993, 03, 11, 2, 25, 35); var formatterFactory = new FormatterSimpleFactory(); FormatterSimpleFactory.Formatter formatter = formatterFactory.CreateFormatter("Uppercase"); string formatted = formatter(new Message(message, null, true, date)); Assert.AreEqual(formatted, "SOME ASDF RANDOM ;LKJ MESSAGE"); }