~ubuntu-branches/ubuntu/lucid/tomboy/lucid-proposed

1.1.4 by Andrew Mitchell
Import upstream version 0.3.9+dfsg
1
namespace TomboyTest
2
{
3
	using System;
4
	using System.IO;
5
	using NUnit.Framework;
6
	using Tomboy;
7
8
	class DebugLogger : ILogger
9
	{
10
		public string Message = null;
11
		public object[] Arguments = null;
12
13
		public void Log (string msg, params object[] args)
14
		{
15
			Message = msg;
16
			Arguments = args;
17
		}
18
	}
19
20
	[TestFixture]
21
	public class LoggerTest
22
	{
23
		DebugLogger logger = null;
24
25
		[SetUp]
26
		public void Setup ()
27
		{
28
			logger = new DebugLogger ();
29
			Logger.Instance = logger;
30
		}
31
32
		[Test]
33
		public void LogSimple ()
34
		{
35
			Logger.Log ("Foo");
36
			Assert.AreEqual ("Foo", logger.Message);
37
			Assert.AreEqual (0, logger.Arguments.Length);
38
		}
39
40
		[Test]
41
		public void LogOneArgument ()
42
		{
43
			Logger.Log ("Foo", "arg");
44
			Assert.AreEqual ("Foo", logger.Message);
45
			Assert.AreEqual (1, logger.Arguments.Length);
46
			Assert.AreEqual ("arg", logger.Arguments[0]);
47
		}
48
49
		[Test]
50
		public void LogTwoArguments ()
51
		{
52
			Logger.Log ("Foo", 1, 2);
53
			Assert.AreEqual ("Foo", logger.Message);
54
			Assert.AreEqual (2, logger.Arguments.Length);
55
			Assert.AreEqual (1, logger.Arguments[0]);
56
			Assert.AreEqual (2, logger.Arguments[1]);
57
		}
58
	}
59
}