Exemple #1
0
        public void GameVersionFilterChangedCommand_IsExecuted_ShouldRaisePropertyChanged()
        {
            // Arrange
            var viewModel = new PresetsTreeSearchViewModel();

            // Act/Assert
            Assert.PropertyChanged(viewModel,
                                   nameof(PresetsTreeSearchViewModel.SelectedGameVersionFilters),
                                   () => viewModel.GameVersionFilterChangedCommand.Execute(null));
        }
Exemple #2
0
        public void ClearSearchTextCommand_ShouldCanExecute()
        {
            // Arrange
            var viewModel = new PresetsTreeSearchViewModel();

            // Act
            var result = viewModel.ClearSearchTextCommand.CanExecute(null);

            // Assert
            Assert.True(result);
        }
        public void Ctor_ShouldSetDefaultValues()
        {
            // Arrange/Act
            var viewModel = new PresetsTreeSearchViewModel();

            // Assert
            Assert.False(viewModel.HasFocus);
            Assert.Empty(viewModel.SearchText);
            Assert.NotNull(viewModel.ClearSearchTextCommand);
            Assert.NotNull(viewModel.GotFocusCommand);
            Assert.NotNull(viewModel.LostFocusCommand);
        }
Exemple #4
0
        public void LostFocusCommand_IsExecuted_ShouldSetHasFocusFalse()
        {
            // Arrange
            var viewModel = new PresetsTreeSearchViewModel();

            viewModel.HasFocus = true;

            // Act
            viewModel.LostFocusCommand.Execute(null);

            // Assert
            Assert.False(viewModel.HasFocus);
        }
Exemple #5
0
        public void SelectedGameVersionFilters_IsCalled_ShouldReturnCorrectCollection()
        {
            // Arrange
            var viewModel = new PresetsTreeSearchViewModel();

            viewModel.GameVersionFilters[0].IsSelected = true;

            // Act
            var result = viewModel.SelectedGameVersionFilters;

            // Assert
            Assert.Single(result);
        }
Exemple #6
0
        public void ClearSearchTextCommand_IsExecuted_ShouldSetSearchTextEmpty()
        {
            // Arrange
            var viewModel = new PresetsTreeSearchViewModel();

            viewModel.SearchText = "dummy";

            // Act
            viewModel.ClearSearchTextCommand.Execute(null);

            // Assert
            Assert.Empty(viewModel.SearchText);
        }
Exemple #7
0
        public void SelectedGameVersions_IsCalled_ShouldSetIsSelectedForCorrectItems()
        {
            // Arrange
            var viewModel = new PresetsTreeSearchViewModel();

            viewModel.GameVersionFilters[0].IsSelected = false;
            viewModel.GameVersionFilters[1].IsSelected = false;

            // Act
            viewModel.SelectedGameVersions = viewModel.GameVersionFilters[0].Type | viewModel.GameVersionFilters[1].Type;

            // Assert
            Assert.True(viewModel.GameVersionFilters[0].IsSelected);
            Assert.True(viewModel.GameVersionFilters[1].IsSelected);
        }
Exemple #8
0
        public void GameVersionFilterChangedCommand_IsExecutedWithGameVersionFilter_ShouldNegateIsSelected()
        {
            // Arrange
            var viewModel = new PresetsTreeSearchViewModel();

            var gameVersionFilter = new GameVersionFilter
            {
                IsSelected = true
            };

            // Act
            viewModel.GameVersionFilterChangedCommand.Execute(gameVersionFilter);

            // Assert
            Assert.False(gameVersionFilter.IsSelected);
        }