示例#1
0
 public void InitializeShouldThrowIfArgumentIsNonNull()
 {
     // Parallel should not have any values or arguments
     ExceptionUtilities.ThrowsException <CommandLineException>(
         () => this.executor.Initialize("123"),
         "Argument " + 123 + " is not expected in the 'Parallel' command. Specify the command without the argument (Example: vstest.console.exe myTests.dll /Parallel) and try again.");
 }
示例#2
0
 public void InIsolationArgumentProcessorExecutorShouldThrowIfArgumentIsProvided()
 {
     // InProcess should not have any values or arguments
     ExceptionUtilities.ThrowsException <CommandLineException>(
         () => this.executor.Initialize("true"),
         "Argument true is not expected in the 'InIsolation' command. Specify the command without the argument (Example: vstest.console.exe myTests.dll /InIsolation) and try again.");
 }
示例#3
0
 public void InitializeShouldThrowIfArgumentIsInvalid()
 {
     ExceptionUtilities.ThrowsException <CommandLineException>(
         () => this.executor.Initialize("foo"),
         "Invalid .Net Framework version:{0}. Please give the fullname of the TargetFramework(Example: .NETCoreApp,Version=v2.0). Other supported .Net Framework versions are Framework40, Framework45, FrameworkCore10 and FrameworkUap10.",
         "foo");
 }
示例#4
0
 public void InitializeShouldThrowIfArgumentIsNotASupportedArchitecture()
 {
     ExceptionUtilities.ThrowsException <CommandLineException>(
         () => this.executor.Initialize("AnyCPU"),
         "Invalid platform type:{0}. Valid platform types are x86, x64 and Arm.",
         "AnyCPU");
 }
示例#5
0
        public void InitializeShouldThrowExceptionIfArgumentIsWhiteSpace()
        {
            Action action = () => new RunSettingsArgumentExecutor(CommandLineOptions.Instance, null).Initialize("  ");

            ExceptionUtilities.ThrowsException <CommandLineException>(
                action,
                "The /Settings parameter requires a settings file to be provided.");
        }
示例#6
0
        public void InitializeShouldThrowExceptionIfFileDoesNotExist()
        {
            var fileName = "C:\\Imaginary\\nonExistentFile.txt";

            var executor       = new RunSettingsArgumentExecutor(CommandLineOptions.Instance, null);
            var mockFileHelper = new Mock <IFileHelper>();

            mockFileHelper.Setup(fh => fh.Exists(It.IsAny <string>())).Returns(false);

            executor.FileHelper = mockFileHelper.Object;

            ExceptionUtilities.ThrowsException <CommandLineException>(
                () => executor.Initialize(fileName),
                "The Settings file '{0}' could not be found.",
                fileName);
        }
示例#7
0
        public void InitializeShouldThrowIfRunSettingsSchemaDoesNotMatch()
        {
            // Arrange.
            var fileName    = "C:\\temp\\r.runsettings";
            var settingsXml = "<BadRunSettings></BadRunSettings>";

            var executor = new TestableRunSettingsArgumentExecutor(
                CommandLineOptions.Instance,
                this.settingsProvider,
                settingsXml);

            // Setup mocks.
            var mockFileHelper = new Mock <IFileHelper>();

            mockFileHelper.Setup(fh => fh.Exists(It.IsAny <string>())).Returns(true);

            executor.FileHelper = mockFileHelper.Object;

            // Act and Assert.
            ExceptionUtilities.ThrowsException <SettingsException>(
                () => executor.Initialize(fileName),
                "Settings file provided does not conform to required format.");
        }
示例#8
0
 public void InitializeShouldThrowIfArgumentIsEmpty()
 {
     ExceptionUtilities.ThrowsException <CommandLineException>(
         () => executor.Initialize("  "),
         "The /Framework argument requires the target .Net Framework version for the test run.   Example:  /Framework:\".NETFramework,Version=v4.5.1\"");
 }
示例#9
0
 public void InitializeShouldThrowIfArgumentIsEmpty()
 {
     ExceptionUtilities.ThrowsException <CommandLineException>(
         () => this.executor.Initialize("  "),
         "The /Platform argument requires the target platform type for the test run to be provided.   Example:  /Platform:x86");
 }