Example #1
0
		public void ActivateOnTerminatedWorkItemThrows()
		{
			WorkItem wi = new TestableRootWorkItem();

			wi.Terminate();
			wi.Activate();
		}
Example #2
0
		public void StatusIsActiveWhenActivateCalled()
		{
			WorkItem wi = new TestableRootWorkItem();

			wi.Activate();

			Assert.AreEqual(WorkItemStatus.Active, wi.Status);
		}
Example #3
0
		public void WorkItemPassesItselfToActivationServiceWhenActivated()
		{
			WorkItem wi = new TestableRootWorkItem();
			MockWorkItemActivationService svc = wi.Services.AddNew<MockWorkItemActivationService, IWorkItemActivationService>();

			wi.Activate();

			Assert.AreEqual(wi, svc.LastChangedItem);
		}
Example #4
0
		public void WorkItemCallsActivationServiceWhenActivated()
		{
			WorkItem wi = new TestableRootWorkItem();
			MockWorkItemActivationService svc = wi.Services.AddNew<MockWorkItemActivationService, IWorkItemActivationService>();

			wi.Activate();

			Assert.IsTrue(svc.ChangeStatusCalled);
		}
Example #5
0
		public void StatusIsInactiveAfterDeactivateCalled()
		{
			WorkItem wi = new TestableRootWorkItem();

			wi.Activate();
			wi.Deactivate();

			Assert.AreEqual(WorkItemStatus.Inactive, wi.Status);
		}
Example #6
0
		public void FiresActivatedEventWhenAcivated()
		{
			WorkItem wi = new TestableRootWorkItem();

			bool activated = false;
			wi.Activated += delegate { activated = true; };
			wi.Activate();

			Assert.IsTrue(activated);
		}
Example #7
0
		public void FiresDeactivatingEventWhenDeactivated()
		{
			WorkItem wi = new TestableRootWorkItem();

			bool deactivating = false;
			wi.Deactivating += delegate { deactivating = true; };
			wi.Activate();
			wi.Deactivate();

			Assert.IsTrue(deactivating);
		}
Example #8
0
		public void CanCancelActivation()
		{
			WorkItem wi = new TestableRootWorkItem();

			bool activated = false;
			wi.Activating += delegate(object sender, CancelEventArgs e) { e.Cancel = true; };
			wi.Activated += delegate { activated = true; };
			wi.Activate();

			Assert.IsFalse(activated);
		}