Пример #1
0
        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));
        }
Пример #3
0
 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);
 }
Пример #4
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));
        }
Пример #5
0
 public FakeExplorerTreeViewModel(
     IConfiguration configuration,
     IPresentationLogic presentationLogic)
     : base(configuration, presentationLogic)
 {
     this.Drives = new ObservableCollection <DriveItemViewModel>();
     this.CreateDefaultFakeExplorerTree();
     this.LoadAllDriveItemViewModelsWasCalled = false;
 }
Пример #6
0
        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);
Пример #7
0
 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
 }
Пример #8
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();
 }
Пример #9
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);
        }
Пример #10
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);
        }
Пример #11
0
        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);
        }
Пример #12
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);
        }
Пример #13
0
        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);
        }
Пример #14
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!");
        }
 private ExplorerTreeItemModelViewModelParser CreateExplorerTreeItemModelViewModelParser(IPresentationLogic fakePresentationLogic = null, IConfiguration fakeConfiguration = null)
 {
     fakePresentationLogic = fakePresentationLogic ?? CreateFakePresentationLogic();
     fakeConfiguration     = fakeConfiguration ?? CreateFakeConfiguration();
     return(new ExplorerTreeItemModelViewModelParser(fakePresentationLogic, fakeConfiguration));
 }
Пример #16
0
 public AOPController(IPresentationLogic logic)
 {
     _logic = logic;
 }
Пример #17
0
 public MainWindow()
 {
     InitializeComponent();
     this.presentationLogic = PresentationLogicFactory.CreatePresentationLogic();
     this.DataContext       = presentationLogic.MainWindowVM;
 }
Пример #18
0
 internal ExplorerTreeItemModelViewModelParser(IPresentationLogic presentationLogic, IConfiguration configuration)
 {
     this.PresentationLogic = presentationLogic;
     this.Configuration     = configuration;
 }