Exemple #1
0
        public void Format_MessageIsInfo_MessageContainsExplanatoryMessage()
        {
            var timeService = new FakeTimeService();
            var current = new DateTime(2012, 08, 28, 12, 0, 0);
            timeService.CurrentDateTime = current;
            var message = new InfoMessage("User Arthur Dent just logged into his account");
            var formatter = new LogFormater(timeService);

            var formattedMessage = formatter.Format(message);

            Assert.IsTrue(formattedMessage.StartsWith("[28.08.2012 12:00][Info] User Arthur Dent just logged into his account"));
        }
Exemple #2
0
        public void Format_MessageIsNotNull_CurrentDateIsFirstThingInMessage()
        {
            var timeService = new FakeTimeService();
            var current = new DateTime(2012, 08, 28, 12, 0, 0);
            timeService.CurrentDateTime = current;
            var message = new InfoMessage("infomessage");
            var formatter = new LogFormater(timeService);

            var formattedMessage = formatter.Format(message);

            Assert.IsTrue(formattedMessage.StartsWith("[28.08.2012 12:00]"));
        }
Exemple #3
0
        public void Format_MessageIsException_InfoIsWrittenAfterDateInMessage()
        {
            var timeService = new FakeTimeService();
            var current = new DateTime(2012, 08, 28, 12, 0, 0);
            timeService.CurrentDateTime = current;
            var message = new ExceptionMessage();
            var formatter = new LogFormater(timeService);

            var formattedMessage = formatter.Format(message);

            Assert.IsTrue(formattedMessage.StartsWith("[28.08.2012 12:00][Exception]"));
        }