private static FakeExplorerTreeViewModel CreateFakeExplorerTreeVM() { IConfiguration stubConfiguration = Substitute.For <IConfiguration>(); IPresentationLogic stubPresentationLogic = Substitute.For <IPresentationLogic>(); return(new FakeExplorerTreeViewModel(stubConfiguration, stubPresentationLogic)); }
private FakeExplorerTreeViewModel CreateFakeExplorerTreeVM(IConfiguration configuration = null) { configuration = configuration ?? CreateConfiguration(); IPresentationLogic fakePresentationLogic = Substitute.For <IPresentationLogic>(); return(new FakeExplorerTreeViewModel(configuration, fakePresentationLogic)); }
internal ExplorerTreeViewModel(IConfiguration configuration, IPresentationLogic presentationLogic) { this.Configuration = configuration; this.Drives = new ObservableCollection <DriveItemViewModel>(); this.ExplorerTreeItemModelViewModelParser = new ExplorerTreeItemModelViewModelParser(presentationLogic, configuration); this.PresentationLogic = presentationLogic; this.SelectedItemHandler = new SelectedExplorerTreeItemHandler(configuration.SelectionConfiguration); }
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)); }
public FakeExplorerTreeViewModel( IConfiguration configuration, IPresentationLogic presentationLogic) : base(configuration, presentationLogic) { this.Drives = new ObservableCollection <DriveItemViewModel>(); this.CreateDefaultFakeExplorerTree(); this.LoadAllDriveItemViewModelsWasCalled = false; }
private static ExplorerTreeViewModel CreateFakeExplorerTreeVMWithSelectedItemHandler(IConfiguration configuration) { IPresentationLogic presentationLogic = Substitute.For <IPresentationLogic>(); var explorerTreeVM = Substitute.For <ExplorerTreeViewModel>(configuration, presentationLogic); var selectedItemHandler = Substitute.For <ISelectedExplorerTreeItemHandler>(); var directorySelectionHandler = Substitute.For <AExplorerTreeItemSelectionHandler>(); selectedItemHandler.DirectorySelectionHandler.Returns(directorySelectionHandler); selectedItemHandler.DirectorySelectionHandler.IsSelectedHasChanged(default, default).ReturnsForAnyArgs(true);
public Program() { //Opsætning af referencer til implementationer af interfaces //icurrentDAL = new CtrlDataAccessLogic(); //icurrentBL = new BPLogic(icurrentDAL); icurrentGUIPL = new SimpelCtrlRPIUI(icurrentBL); //Eller omstil til en anden for UI (User Interface) //icurrentGUIPL = new AnotherGUI(icurrentBL); icurrentGUIPL.startUpGUI();//Trin start applikation }
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_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_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 ExplorerTreeVM_SetGet_ReturnsSetValue() { IConfiguration fakeConfiguration = Substitute.For <IConfiguration>(); IPresentationLogic fakePresentationLogic = Substitute.For <IPresentationLogic>(); var expected = new FakeExplorerTreeViewModel(fakeConfiguration, fakePresentationLogic); var presentationLogic = CreatePresentationLogic(); presentationLogic.ExplorerTreeVM = expected; Assert.AreEqual(expected, presentationLogic.ExplorerTreeVM); }
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 LoadAllDriveItemModels_ReturnCollectionFromBusinessLogic_CollectionReturned() { var mockBusinessLogic = Substitute.For <IBusinessLogic>(); var mockDriveItemModels = new List <DriveItemModel>(); var stubDriveItemModel = Substitute.For <IExplorerTreeItemModel>(); mockDriveItemModels.Add(stubDriveItemModel as DriveItemModel); mockBusinessLogic.LoadAllDriveItemModels().Returns(mockDriveItemModels); IPresentationLogic presentationLogic = CreatePresentationLogic(mockBusinessLogic); var returnValue = presentationLogic.LoadAllDriveItemModels(); Assert.AreEqual(mockDriveItemModels, returnValue); }
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!"); }
private ExplorerTreeItemModelViewModelParser CreateExplorerTreeItemModelViewModelParser(IPresentationLogic fakePresentationLogic = null, IConfiguration fakeConfiguration = null) { fakePresentationLogic = fakePresentationLogic ?? CreateFakePresentationLogic(); fakeConfiguration = fakeConfiguration ?? CreateFakeConfiguration(); return(new ExplorerTreeItemModelViewModelParser(fakePresentationLogic, fakeConfiguration)); }
public AOPController(IPresentationLogic logic) { _logic = logic; }
public MainWindow() { InitializeComponent(); this.presentationLogic = PresentationLogicFactory.CreatePresentationLogic(); this.DataContext = presentationLogic.MainWindowVM; }
internal ExplorerTreeItemModelViewModelParser(IPresentationLogic presentationLogic, IConfiguration configuration) { this.PresentationLogic = presentationLogic; this.Configuration = configuration; }