Beispiel #1
0
		static void Host_SetToProvider ()
		{
			var tns1 = new TestNotificationSystem ();
			var tns2 = new TestNotificationSystem ();
			ObjectCache.Host = tns1;
			Assert.IsNotNull (ObjectCache.Host, "#A3-1");
			Assert.AreEqual (tns1, ObjectCache.Host, "#A3-2");

			AssertExtensions.Throws<InvalidOperationException> (() => {
				ObjectCache.Host = tns2;
			}, "#A4");
		}
		static void Dispose_NullState_NoStopMonitoring_Handler ()
		{
			Tuple<string, string, string, IList<string>> setup = null;
			try {
				var tns = new TestNotificationSystem ();
				tns.UseNullState = true;
				ObjectCache.Host = tns;
				setup = SetupMonitoring ();
				var monitor = new HostFileChangeMonitor (setup.Item4);
				tns.FakeChanged (setup.Item2);

				Assert.IsFalse (tns.StopMonitoringCalled, "#A1-1");
				Assert.AreEqual (0, tns.StopMonitoringCallCount, "#A1-2");
			} finally {
				CleanupMonitoring (setup);
			}
		}
		static void Constructor_Calls_StartMonitoring_Handler ()
		{
			Tuple<string, string, string, IList<string>> setup = null;
			try {
				var tns = new TestNotificationSystem ();
				ObjectCache.Host = tns;
				setup = SetupMonitoring ();
				var monitor = new HostFileChangeMonitor (setup.Item4);

				Assert.IsTrue (tns.StartMonitoringCalled, "#A1-1");
				Assert.AreEqual (2, tns.StartMonitoringCallCount, "#A1-2");
			} finally {
				CleanupMonitoring (setup);
			}
		}