Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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!");
        }