Beispiel #1
0
        public void TestDataVMInit()
        {
            // Make sure our VMs are not null
            Assert.IsNotNull(dataVM);
            Assert.IsNotNull(controlVM);
            Assert.IsNotNull(graphVM);

            // Run our init, which simply calls two other inits:
            dataVM.DataInit();

            /*
             *      ControlVM.ControlInit
             *      This is tested explicitly above, but it doesn't hurt to test it as its called from DataVM
             */
            // Pull a copy from ControlVM's stored key value, as well as from the list of keys directly
            IncomeYearModel testOutputFromInit;
            IncomeYearModel testOutputFromList;

            yearsModel.Years.TryGetValue(controlVM.SelectedYear, out testOutputFromInit);
            yearsModel.Years.TryGetValue(yearsModel.YearList[0], out testOutputFromList);

            // Neither of the objects should be null
            Assert.IsNotNull(testOutputFromInit);
            Assert.IsNotNull(testOutputFromList);

            // They should also be the same object
            Assert.AreSame(testOutputFromInit, testOutputFromList);

            /*
             *      GraphVM.GraphInit()
             */

            // Still TODO
        }
Beispiel #2
0
        public Loader()
        {
            // Make models

            YearsModel = new YearsModel();
            GraphModel = new GraphModel();
            DataModel  = new DataModel();

            // Load CSVs
            LoadYears();

            // make viewmodels
            MainVM     = new MainViewModel();
            DataVM     = new DataViewModel();
            ControlVM  = new ControlViewModel();
            GraphVM    = new GraphViewModel();
            OutputVM   = new OutputViewModel();
            SettingsVM = new SettingsViewModel();

            // Link VMs
            MainVM.DataVM     = DataVM;
            MainVM.SettingsVM = SettingsVM;

            DataVM.ControlVM = ControlVM;
            DataVM.GraphVM   = GraphVM;
            DataVM.OutputVM  = OutputVM;

            ControlVM.MainVM   = MainVM;
            ControlVM.DataVM   = DataVM;
            ControlVM.OutputVM = OutputVM;
            ControlVM.GraphVM  = GraphVM;

            SettingsVM.MainVM = MainVM;

            // Connect models to VMs

            DataVM.DataModel  = DataModel;
            DataVM.YearsModel = YearsModel;
            DataVM.GraphModel = GraphModel;

            ControlVM.YearsModel = YearsModel;
            ControlVM.GraphModel = GraphModel;
            ControlVM.DataModel  = DataModel;

            GraphVM.GraphModel = GraphModel;
            GraphVM.YearsModel = YearsModel;
            GraphVM.DataModel  = DataModel;

            OutputVM.DataModel = DataModel;

            DataVM.DataInit();
        }