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)); }
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)); }
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); }
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)); }
public void RegisterSmartPartInfoIsGuardedForNullSmartPartInfo() { WorkItem wi = new TestableRootWorkItem(); wi.RegisterSmartPartInfo(new Control(), null); }