/// <summary> /// Initializes a new instance of the <see cref="MainWindowViewModel"/> class. /// </summary> /// <param name="pointGenerator">Point generator to use when creating mine cells.</param> public MainWindowViewModel(IPointGenerator pointGenerator) { var defaultSettings = new DefaultGameSettings(pointGenerator); GameViewModel = new MineSearchGameViewModel(defaultSettings); SettingsRequest = new InteractionRequest<SettingsViewModel>(); SettingsCommand = new DelegateCommand(RaiseSettingsRequest); ExitCommand = new DelegateCommand<IBaseWindow>(CloseWindow); }
public void TestFlagCommandQuestionableEnabled() { _gameSettings.UseQuestionableState = true; _gameViewModel = new MineSearchGameViewModel(_gameSettings); // Grab the first view model var cellViewModel = _gameViewModel.CellViewModels[0].First(); var cell = cellViewModel.Cell; // Execute the flag command to mark the cell as flagged cellViewModel.FlagCommand.Execute(null); Assert.IsTrue(cell.Flagged); Assert.IsFalse(cell.Questionable); // Execute the flag command a second time to mark the cell as questionable cellViewModel.FlagCommand.Execute(null); Assert.IsTrue(cell.Questionable); Assert.IsFalse(cell.Flagged); // Execute the flag command a third time to clear the cell cellViewModel.FlagCommand.Execute(null); Assert.IsFalse(cell.Flagged); Assert.IsFalse(cell.Questionable); }
public void TestInitialize() { _generator = new RandomPointGenerator(); _gameSettings = new GameSettings(4, 4, 4, _generator); _gameViewModel = new MineSearchGameViewModel(_gameSettings); }