Beispiel #1
0
        public MainViewModel(IMainModelSerializer mainModelSerializer, IFileSystem fileSystem)
        {
            this.documentationFormats =
                new MultiSelectableCollection <DocumentationFormat>(
                    Enum.GetValues(typeof(DocumentationFormat)).Cast <DocumentationFormat>());
            this.documentationFormats.First().IsSelected = true;
            this.documentationFormats.SelectionChanged  += this.DocumentationFormatsOnCollectionChanged;

            this.testResultsFormats =
                new SelectableCollection <TestResultsFormat>(
                    Enum.GetValues(typeof(TestResultsFormat)).Cast <TestResultsFormat>());
            this.testResultsFormats.First().IsSelected = true;
            this.testResultsFormats.SelectionChanged  += this.TestResultsFormatsOnCollectionChanged;

            this.browseForFeatureFolderCommand   = new RelayCommand(this.DoBrowseForFeature);
            this.browseForOutputFolderCommand    = new RelayCommand(this.DoBrowseForOutputFolder);
            this.browseForTestResultsFileCommand = new RelayCommand(this.DoBrowseForTestResultsFile);
            this.generateCommand     = new RelayCommand(this.DoGenerate, this.CanGenerate);
            this.openOutputDirectory = new RelayCommand(this.DoOpenOutputDirectory, this.CanOpenOutputDirectory);

            this.PropertyChanged += this.MainWindowViewModelPropertyChanged;
            this.neutralCultures  = CultureInfo.GetCultures(CultureTypes.NeutralCultures);
            this.selectedLanguage = CultureInfo.GetCultureInfo("en");

            this.mainModelSerializer = mainModelSerializer;
            this.fileSystem          = fileSystem;
        }
Beispiel #2
0
        /// <summary>
        /// Add item to selectable collection.
        /// </summary>
        public static void Add <T>(this SelectableCollection <CollectionItem <T> > source, T value, string displayValue)
        {
            var item = new CollectionItem <T>()
            {
                Value = value, DisplayValue = displayValue
            };

            source.Add(item);
        }
        public void T2()
        {
            // Arrange
            var collection = new SelectableCollection <double>();

            // Act
            collection.AddSelectable(134.32);

            // Assert
            Assert.Empty(collection);
        }
        public void T0()
        {
            // Arrange
            var collection = new SelectableCollection <ISelectable>();

            // Act
            collection.AddSelectable(TestMarket);

            // Assert
            Assert.Single(collection);
        }
        public void T1()
        {
            // Arrange
            var collection = new SelectableCollection <ISelectable>();
            var testMarket = TestMarket;

            collection.AddSelectable(testMarket);
            var catcher = Catcher.Simple;

            collection.SelectedChanged += catcher.Catch;

            // Act
            testMarket.IsSelected = false;

            // Assert
            catcher.CaughtEmpty(collection);
        }
        public MainWindowViewModel(IMainModelSerializer mainModelSerializer)
        {
            documentationFormats = new MultiSelectableCollection <DocumentationFormat>(Enum.GetValues(typeof(DocumentationFormat)).Cast <DocumentationFormat>());
            documentationFormats.First().IsSelected = true;
            documentationFormats.SelectionChanged += DocumentationFormatsOnCollectionChanged;

            testResultsFormats = new SelectableCollection <TestResultsFormat>(Enum.GetValues(typeof(TestResultsFormat)).Cast <TestResultsFormat>());
            testResultsFormats.First().IsSelected = true;
            testResultsFormats.SelectionChanged += TestResultsFormatsOnCollectionChanged;

            browseForFeatureFolderCommand   = new RelayCommand(DoBrowseForFeature);
            browseForOutputFolderCommand    = new RelayCommand(DoBrowseForOutputFolder);
            browseForTestResultsFileCommand = new RelayCommand(DoBrowseForTestResultsFile);
            generateCommand     = new RelayCommand(DoGenerate, CanGenerate);
            openOutputDirectory = new RelayCommand(DoOpenOutputDirectory, CanOpenOutputDirectory);

            this.PropertyChanged += MainWindowViewModel_PropertyChanged;
            neutralCultures       = CultureInfo.GetCultures(CultureTypes.NeutralCultures);
            selectedLanguage      = CultureInfo.GetCultureInfo("en");

            this.mainModelSerializer = mainModelSerializer;
        }
        public MainWindowViewModel(IMainModelSerializer mainModelSerializer, IFileSystem fileSystem)
        {
            this.documentationFormats = new MultiSelectableCollection<DocumentationFormat>(Enum.GetValues(typeof(DocumentationFormat)).Cast<DocumentationFormat>());
            this.documentationFormats.First().IsSelected = true;
            this.documentationFormats.SelectionChanged += this.DocumentationFormatsOnCollectionChanged;

            this.testResultsFormats = new SelectableCollection<TestResultsFormat>(Enum.GetValues(typeof(TestResultsFormat)).Cast<TestResultsFormat>());
            this.testResultsFormats.First().IsSelected = true;
            this.testResultsFormats.SelectionChanged += this.TestResultsFormatsOnCollectionChanged;

            this.browseForFeatureFolderCommand = new RelayCommand(this.DoBrowseForFeature);
            this.browseForOutputFolderCommand = new RelayCommand(this.DoBrowseForOutputFolder);
            this.browseForTestResultsFileCommand = new RelayCommand(this.DoBrowseForTestResultsFile);
            this.generateCommand = new RelayCommand(this.DoGenerate, this.CanGenerate);
            this.openOutputDirectory = new RelayCommand(this.DoOpenOutputDirectory, this.CanOpenOutputDirectory);

            this.PropertyChanged += this.MainWindowViewModel_PropertyChanged;
            this.neutralCultures = CultureInfo.GetCultures(CultureTypes.NeutralCultures);
            this.selectedLanguage = CultureInfo.GetCultureInfo("en");

            this.mainModelSerializer = mainModelSerializer;
            this.fileSystem = fileSystem;
        }