private ExplorerTree.API.ExplorerTree CreateExplorerTree() { IConfiguration fakeConfiguration = Substitute.For <IConfiguration>(); IPresentationLogic fakePresentationLogic = Substitute.For <IPresentationLogic>(); ISelectedExplorerTreeItemAPI fakeSelectedExplorerTreeItemAPI = Substitute.For <ISelectedExplorerTreeItemAPI>(); FakeExplorerTreeViewModel fakeExplorerTreeVM = new FakeExplorerTreeViewModel(fakeConfiguration, fakePresentationLogic); return(new ExplorerTree.API.ExplorerTree(fakeConfiguration, fakeExplorerTreeVM, fakePresentationLogic, fakeSelectedExplorerTreeItemAPI)); }
internal ExplorerTree(IConfiguration configuration = null, ExplorerTreeViewModel explorerTreeViewModel = null, IPresentationLogic presentationLogic = null, ISelectedExplorerTreeItemAPI selectedExplorerTreeItemAPI = null) { this.configuration = configuration ?? new Configuration.Configuration(); this.PresentationLogic = presentationLogic ?? PresentationLogicFactory.CreatePresentationLogic(configuration); this.explorerTreeVM = explorerTreeViewModel ?? new ExplorerTreeViewModel((this as IExplorerTree).Configuration, this.PresentationLogic); this.PresentationLogic.ExplorerTreeVM = this.explorerTreeVM; (this as IExplorerTree).Configuration.Initialisation((this as IExplorerTree).ExplorerTreeVM); this.selectedItemAPI = selectedExplorerTreeItemAPI ?? new SelectedExplorerTreeItemAPI(this.explorerTreeVM); this.explorerTreeVM.LoadAllDriveItemViewModels(); }
public void ExplorerTree_DefaultInitialisation_ExplorerTreeMethodLoadAllDriveItemViewModelsWasCalled() { IConfiguration fakeConfiguration = Substitute.For <IConfiguration>(); IPresentationLogic fakePresentationLogic = Substitute.For <IPresentationLogic>(); ISelectedExplorerTreeItemAPI fakeSelectedExplorerTreeItemAPI = Substitute.For <ISelectedExplorerTreeItemAPI>(); FakeExplorerTreeViewModel fakeExplorerTreeVM = new FakeExplorerTreeViewModel(fakeConfiguration, fakePresentationLogic); IExplorerTree explorerTree = new ExplorerTree.API.ExplorerTree(fakeConfiguration, fakeExplorerTreeVM, fakePresentationLogic, fakeSelectedExplorerTreeItemAPI); Assert.AreEqual(true, fakeExplorerTreeVM.LoadAllDriveItemViewModelsWasCalled); }
public void ExplorerTree_DefaultInitialisation_CofigurationMethodInitialisationWasCalledWithExplorerTreeVM() { IConfiguration fakeConfiguration = Substitute.For <IConfiguration>(); IPresentationLogic fakePresentationLogic = Substitute.For <IPresentationLogic>(); ISelectedExplorerTreeItemAPI fakeSelectedExplorerTreeItemAPI = Substitute.For <ISelectedExplorerTreeItemAPI>(); FakeExplorerTreeViewModel fakeExplorerTreeVM = new FakeExplorerTreeViewModel(fakeConfiguration, fakePresentationLogic); IExplorerTree explorerTree = new ExplorerTree.API.ExplorerTree(fakeConfiguration, fakeExplorerTreeVM, fakePresentationLogic, fakeSelectedExplorerTreeItemAPI); fakeConfiguration.Received().Initialisation(fakeExplorerTreeVM); }
public void ExplorerTree_DefaultInitialisation_PresentationLogicPropertyExplorerTreeVMIsInitialised() { IConfiguration fakeConfiguration = Substitute.For <IConfiguration>(); IPresentationLogic fakePresentationLogic = Substitute.For <IPresentationLogic>(); ISelectedExplorerTreeItemAPI fakeSelectedExplorerTreeItemAPI = Substitute.For <ISelectedExplorerTreeItemAPI>(); FakeExplorerTreeViewModel fakeExplorerTreeVM = new FakeExplorerTreeViewModel(fakeConfiguration, fakePresentationLogic); IExplorerTree explorerTree = new ExplorerTree.API.ExplorerTree(fakeConfiguration, fakeExplorerTreeVM, fakePresentationLogic, fakeSelectedExplorerTreeItemAPI); Assert.AreEqual(fakePresentationLogic.ExplorerTreeVM, (explorerTree as ExplorerTree.API.ExplorerTree).PresentationLogic.ExplorerTreeVM); }
public void ExplorerTree_DefaultInitialisation_AllPropertiesAreInitialised() { IConfiguration fakeConfiguration = Substitute.For <IConfiguration>(); IPresentationLogic fakePresentationLogic = Substitute.For <IPresentationLogic>(); ISelectedExplorerTreeItemAPI fakeSelectedExplorerTreeItemAPI = Substitute.For <ISelectedExplorerTreeItemAPI>(); FakeExplorerTreeViewModel fakeExplorerTreeVM = new FakeExplorerTreeViewModel(fakeConfiguration, fakePresentationLogic); IExplorerTree explorerTree = new ExplorerTree.API.ExplorerTree(fakeConfiguration, fakeExplorerTreeVM, fakePresentationLogic, fakeSelectedExplorerTreeItemAPI); Assert.AreEqual(fakeConfiguration, explorerTree.Configuration, "Property: \"" + nameof(explorerTree.Configuration) + "\" was Not initialised correctly!"); Assert.AreEqual(fakePresentationLogic, (explorerTree as ExplorerTree.API.ExplorerTree).PresentationLogic, "Property: \"" + "PresentationLogic" + "\" was Not initialised correctly!"); Assert.AreEqual(fakeSelectedExplorerTreeItemAPI, explorerTree.SelectedItemAPI, "Property: \"" + nameof(explorerTree.SelectedItemAPI) + "\" was Not initialised correctly!"); Assert.AreEqual(fakeExplorerTreeVM, explorerTree.ExplorerTreeVM, "Property: \"" + nameof(explorerTree.ExplorerTreeVM) + "\" was Not initialised correctly!"); }