示例#1
0
        public void SyslogLogger_TwoLogManyCalls_WillRunSequentially()
        {
            var watcher = new SyslogWatcher(FakeAppName, SyslogFileToWatch);
            var logger1 = new SyslogLogger(FakeAppName + "1");
            var logger2 = new SyslogLogger(FakeAppName + "2");

            watcher.StartWatching();
            string[] messages =
            {
                "First log message",
                "Second log message",
                "Third log message",
                "Fourth log message",
                "Fifth log message"
            };
            logger1.LogMany(SyslogPriority.Error, messages);
            logger2.LogMany(SyslogPriority.Error, messages);
            string[] data = watcher.WaitForData(10).ToArray();
            watcher.StopWatching();
            for (int i = 0; i < messages.Length; i++)
            {
                // Expect messages in sequence, logger1's five lines followed by logger2's five lines
                string expectedAppName = FakeAppName + (i / 5 == 0 ? "1" : "2");
                Assert.That(data[i], Is.StringContaining(expectedAppName));
                Assert.That(data[i], Is.StringContaining(messages[i % 5]));
            }
        }
示例#2
0
		public void SyslogLogger_LogMany_WritesManyLines()
		{
			var watcher = new SyslogWatcher(FakeAppName, SyslogFileToWatch);
			var logger = new SyslogLogger(FakeAppName);
			watcher.StartWatching();
			string[] messages = 
			{
				"First log message",
				"Second log message",
				"Third log message",
				"Fourth log message",
				"Fifth log message"
			};
			logger.LogMany(SyslogPriority.Error, messages);
			string[] data = watcher.WaitForData(5).ToArray();
			watcher.StopWatching();
			for (int i = 0; i < messages.Length; i++)
				Assert.That(data[i], Is.StringContaining(messages[i]));
		}
示例#3
0
        public void SyslogLogger_LogMany_WritesManyLines()
        {
            var watcher = new SyslogWatcher(FakeAppName, SyslogFileToWatch);
            var logger  = new SyslogLogger(FakeAppName);

            watcher.StartWatching();
            string[] messages =
            {
                "First log message",
                "Second log message",
                "Third log message",
                "Fourth log message",
                "Fifth log message"
            };
            logger.LogMany(SyslogPriority.Error, messages);
            string[] data = watcher.WaitForData(5).ToArray();
            watcher.StopWatching();
            for (int i = 0; i < messages.Length; i++)
            {
                Assert.That(data[i], Is.StringContaining(messages[i]));
            }
        }
示例#4
0
		public void SyslogLogger_TwoLogManyCalls_WillRunSequentially()
		{
			var watcher = new SyslogWatcher(FakeAppName, SyslogFileToWatch);
			var logger1 = new SyslogLogger(FakeAppName + "1");
			var logger2 = new SyslogLogger(FakeAppName + "2");
			watcher.StartWatching();
			string[] messages = 
			{
				"First log message",
				"Second log message",
				"Third log message",
				"Fourth log message",
				"Fifth log message"
			};
			logger1.LogMany(SyslogPriority.Error, messages);
			logger2.LogMany(SyslogPriority.Error, messages);
			string[] data = watcher.WaitForData(10).ToArray();
			watcher.StopWatching();
			for (int i = 0; i < messages.Length; i++)
			{
				// Expect messages in sequence, logger1's five lines followed by logger2's five lines
				string expectedAppName = FakeAppName + (i / 5 == 0 ? "1" : "2");
				Assert.That(data[i], Is.StringContaining(expectedAppName));
				Assert.That(data[i], Is.StringContaining(messages[i % 5]));
			}
		}