public void CreateGaleShapley()
        {
            NewModel();

            _model.CreateGaleShapleyAlgorithm();
            Assert.AreEqual(1, _context.Algorithms.Count());

            _visitor = new AlgorithmVisitor(null, () => Assert.Fail());
            _visitor.Visit(_context.Algorithms[0].Element);
            Assert.IsTrue(_context.AlgorithmsChanged);
        }
Beispiel #2
0
        public void NewAlgorithmModel()
        {
            NewModel();
            SetupModel setupModel = _model.NewSetupModel();

            setupModel.Initialize();
            ParticipantsModel participantsModel = _model.NewParticipantsModel();

            participantsModel.Initialize();
            PreferencesModel preferencesModel = _model.NewPreferencesModel();

            preferencesModel.Initialize();
            AlgorithmModel algorithmModel = _model.NewAlgorithmModel();

            algorithmModel.Initialize();
            _context.AlgorithmsChanged = false;

            algorithmModel.CreateGaleShapleyAlgorithm();
            Assert.AreEqual(1, _context.Algorithms.Count());

            AlgorithmVisitor _visitor = new AlgorithmVisitor(null, () => Assert.Fail());

            _visitor.Visit(_context.Algorithms[0].Element);
            Assert.IsTrue(_context.AlgorithmsChanged);
        }
        public void RefreshPage()
        {
            NewViewModel();
            _model.CreateGaleShapleyAlgorithm();
            _model.CreateGeneticAlgorithm();

            _viewModel.RefreshPage();
            Assert.AreEqual(2, _viewModel.AlgorithmOptions.Count());
            Assert.IsInstanceOfType(_viewModel.AlgorithmOptions[0], typeof(AlgorithmOptionGaleShapley));
            Assert.IsInstanceOfType(_viewModel.AlgorithmOptions[1], typeof(AlgorithmOptionGenetic));
        }
        private void OnNewGaleShapleyAlgorithmCommand()
        {
            _model.CreateGaleShapleyAlgorithm();
            AlgorithmOptionGaleShapley alg = new AlgorithmOptionGaleShapley(
                _context.GetAlgorithms.Last().Name,
                AlgorithmOptions.Count()
                );

            AlgorithmOptions.Add(alg);
            AlgorithmElements.Add(alg);

            //UpdateGeneticSettings(alg.Index);
            OnPropertyChanged("AlgorithmOptions");
        }
Beispiel #5
0
        private void NewModel()
        {
            _context = new ModelContext();
            SetupModel setupModel = new SetupModel(_context);

            setupModel.Initialize();
            ParticipantsModel participantsModel = new ParticipantsModel(_context);

            participantsModel.Initialize();
            PreferencesModel preferencesModel = new PreferencesModel(_context);

            preferencesModel.Initialize();
            AlgorithmModel algorithmModel = new AlgorithmModel(_context);

            algorithmModel.Initialize();
            algorithmModel.CreateGaleShapleyAlgorithm();
            algorithmModel.CreateGeneticAlgorithm();
            _model = new RunModel(_context);
            _model.Initialize();
            _context.AlgorithmsChanged = false;
        }
        private void NewViewModel()
        {
            _context   = new ModelContext();
            _model     = new RunModel(_context);
            _viewModel = new RunViewModel(_model, _context);

            SetupModel setupModel = new SetupModel(_context);

            setupModel.Initialize();
            ParticipantsModel participantsModel = new ParticipantsModel(_context);

            participantsModel.Initialize();
            PreferencesModel preferencesModel = new PreferencesModel(_context);

            preferencesModel.Initialize();
            AlgorithmModel algorithmModel = new AlgorithmModel(_context);

            algorithmModel.Initialize();

            algorithmModel.CreateGaleShapleyAlgorithm();
            algorithmModel.CreateGeneticAlgorithm();

            _viewModel.RefreshPage();
        }