public void TestHistoryProvider_DuplicateAdding() { var c = WhenIHaveA <Catalogue>(); var provider = new HistoryProvider(RepositoryLocator); provider.Clear(); Assert.IsEmpty(provider.History); provider.Add(c); Assert.AreEqual(1, provider.History.Count); provider.Add(c); Assert.AreEqual(1, provider.History.Count); provider.Add(c); Assert.AreEqual(1, provider.History.Count); var p = WhenIHaveA <Project>(); provider.Add(p); Assert.AreEqual(2, provider.History.Count); }
public override void RequestItemEmphasis(object sender, EmphasiseRequest request) { //ensure a relevant Toolbox is available var descendancy = CoreChildProvider.GetDescendancyListIfAnyFor(request.ObjectToEmphasise); object root = null; if (descendancy != null) { root = descendancy.Parents.FirstOrDefault(); } else { root = request.ObjectToEmphasise; //assume maybe o is a root object itself? } if (root is CohortIdentificationConfiguration cic) { Activate <CohortIdentificationConfigurationUI, CohortIdentificationConfiguration>(cic); } else if (root != null) { _windowManager.ShowCollectionWhichSupportsRootObjectType(root); } //really should be a listener now btw since we just launched the relevant Toolbox if it wasn't there before //Look at assignments to Sender, the invocation list can change the Sender! var args = new EmphasiseEventArgs(request); base.OnEmphasise(this, args); //might be different than sender that was passed in if (args.Sender is DockContent content) { content.Activate(); } //user is being shown the given object so track it as a recent (e.g. GoTo etc) HistoryProvider.Add(args.Request.ObjectToEmphasise); }