private void SetConfiguration(string example, TestResultsFormat format)
        {
            var configuration = this.Container.Resolve <IConfiguration>();

            configuration.TestResultsFormat = format;
            configuration.AddTestResultFiles(new[] { this.FileSystem.FileInfo.FromFileName(example) });
        }
示例#2
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        = Enum.GetValues(typeof(TestResultsFormat)).Cast <TestResultsFormat>().ToArray();
            this.selectedTestResultsFormat = TestResultsFormat.NUnit;

            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.generatePowerShellCommandCommand = new RelayCommand(this.DoGeneratePowerShellCommand, this.CanGenerate);
            this.generateCLICommandCommand        = new RelayCommand(this.DoGenerateCLICommand, 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;
        }
        public void ThenCanResolve(string exampleFilename, string resourceName, TestResultsFormat resultFormat, Type resultType)
        {
            if (exampleFilename != null)
            {
                this.SetFileSystem(exampleFilename, resourceName);
                this.SetConfiguration(exampleFilename, resultFormat);
            }

            var item = Container.Resolve <ITestResults>();

            Check.That(item).IsNotNull();
            Check.That(item).IsInstanceOfType(resultType);
        }
示例#4
0
        private void ThenCanParseResultsFormatSuccessfully(string argumentName, string argument, TestResultsFormat expectedResultsFormat)
        {
            var args = new[] { argumentName + argument };

            var  configuration             = new Configuration();
            var  commandLineArgumentParser = new CommandLineArgumentParser(FileSystem);
            bool shouldContinue            = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null);

            Check.That(shouldContinue).IsTrue();
            Check.That(configuration.TestResultsFormat).IsEqualTo(expectedResultsFormat);
        }
示例#5
0
 public void ThenCanParseResultsFormatWithShortFormSuccessfully(string argument, TestResultsFormat expectedResultsFormat)
 {
     this.ThenCanParseResultsFormatSuccessfully(@"-trfmt=", argument, expectedResultsFormat);
 }
示例#6
0
 public void ThenCanParseResultsFormatWithLongFormSuccessfully(string argument, TestResultsFormat expectedResultsFormat)
 {
     this.ThenCanParseResultsFormatSuccessfully(@"-test-results-format=", argument, expectedResultsFormat);
 }
示例#7
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 = Enum.GetValues(typeof(TestResultsFormat)).Cast<TestResultsFormat>().ToArray();
            this.selectedTestResultsFormat = TestResultsFormat.NUnit;

            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;
        }