Exemplo n.º 1
0
		public void RegisteringSameTypeSmartPartInfoKeepsTheLastOne()
		{
			WorkItem wi = new TestableRootWorkItem();
			MySmartPartInfo info1 = new MySmartPartInfo();
			MySmartPartInfo info2 = new MySmartPartInfo();
			Control ctrl = new Control();

			wi.RegisterSmartPartInfo(ctrl, info1);
			wi.RegisterSmartPartInfo(ctrl, info2);

			Assert.AreSame(info2, wi.GetSmartPartInfo<MySmartPartInfo>(ctrl));
		}
Exemplo n.º 2
0
		public void CanRegisterSeveralTypesOfSmartPartInfos()
		{
			WorkItem wi = new TestableRootWorkItem();
			MySmartPartInfo info1 = new MySmartPartInfo();
			MyOtherSmartPartInfo info2 = new MyOtherSmartPartInfo();
			Control ctrl = new Control();

			wi.RegisterSmartPartInfo(ctrl, info1);
			wi.RegisterSmartPartInfo(ctrl, info2);

			Assert.AreSame(info1, wi.GetSmartPartInfo<MySmartPartInfo>(ctrl));
			Assert.AreSame(info2, wi.GetSmartPartInfo<MyOtherSmartPartInfo>(ctrl));
		}
Exemplo n.º 3
0
		public void GettingForNotRegisteredReturnsNull()
		{
			WorkItem wi = new TestableRootWorkItem();
			Control ctrl = new Control();
			wi.RegisterSmartPartInfo(ctrl, new SmartPartInfo("foo", "bar"));

			MySmartPartInfo info = wi.GetSmartPartInfo<MySmartPartInfo>(ctrl);

			Assert.IsNull(info);
		}
Exemplo n.º 4
0
		public void CanRegisterASmartPartInfoForAControl()
		{
			WorkItem wi = new TestableRootWorkItem();
			Control ctrl = new Control();
			ISmartPartInfo info = new MySmartPartInfo();
			info.Title = "Title";
			info.Description = "Description";

			wi.RegisterSmartPartInfo(ctrl, info);

			Assert.AreSame(info, wi.GetSmartPartInfo<MySmartPartInfo>(ctrl));
		}
Exemplo n.º 5
0
		public void RegisterSmartPartInfoIsGuardedForNullSmartPartInfo()
		{
			WorkItem wi = new TestableRootWorkItem();

			wi.RegisterSmartPartInfo(new Control(), null);
		}