/
ArgumentProcessorTests.cs
61 lines (47 loc) · 2.45 KB
/
ArgumentProcessorTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.TestPlatform.AcceptanceTests
{
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
[TestCategory("Windows-Review")]
public class ArgumentProcessorTests : AcceptanceTestBase
{
[TestMethod]
[TestCategory("Windows-Review")]
[NetFullTargetFrameworkDataSource]
public void PassingNoArgumentsToVsTestConsoleShouldPrintHelpMessage(RunnerInfo runnerInfo)
{
AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo);
this.InvokeVsTest(null);
//Check for help usage, description and arguments text.
this.StdOutputContains("Usage: vstest.console.exe");
this.StdOutputContains("Description: Runs tests from the specified files.");
this.StdOutputContains("Arguments:");
//Check for help options text
this.StdOutputContains("Options:");
//Check for help examples text
this.StdOutputContains("To run tests: >vstest.console.exe tests.dll");
}
[TestMethod]
[TestCategory("Windows-Review")]
[NetFullTargetFrameworkDataSource]
public void PassingInvalidArgumentsToVsTestConsoleShouldNotPrintHelpMessage(RunnerInfo runnerInfo)
{
AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo);
var arguments = PrepareArguments(this.GetSampleTestAssembly(), this.GetTestAdapterPath(), string.Empty, this.FrameworkArgValue);
arguments = string.Concat(arguments, " /badArgument");
this.InvokeVsTest(arguments);
//Check for help usage, description and arguments text.
this.StdOutputDoesNotContains("Usage: vstest.console.exe");
this.StdOutputDoesNotContains("Description: Runs tests from the specified files.");
this.StdOutputDoesNotContains("Arguments:");
//Check for help options text
this.StdOutputDoesNotContains("Options:");
//Check for help examples text
this.StdOutputDoesNotContains("To run tests: >vstest.console.exe tests.dll");
//Check for message which guides using help option
this.StdErrorContains("Please use the /help option to check the list of valid arguments");
}
}
}