private async Task <string> GetTestCommandArgumentsAsync(string source, TestCommandType testType = TestCommandType.Single) { var workspace = TestHelpers.CreateSimpleWorkspace(source); var context = new AspNet5Context(); var projectName = "project.json"; var projectCounter = 1; context.ProjectContextMapping.Add(projectName, projectCounter); context.Projects.Add(projectCounter, new Project { Path = "project.json", Commands = { { "test", "Xunit.KRunner" } } }); var testCommandProviders = new[] { new AspNet5TestCommandProvider(context, new FakeEnvironment(), new FakeLoggerFactory(), new NullEventEmitter(), new FakeOmniSharpOptions()) }; var controller = new TestCommandController(workspace, testCommandProviders); var lineColumn = TestHelpers.GetLineAndColumnFromDollar(source); var request = new TestCommandRequest { Line = lineColumn.Line, Column = lineColumn.Column, FileName = "dummy.cs", Buffer = source.Replace("$", ""), Type = testType }; var bufferFilter = new UpdateBufferFilter(workspace); bufferFilter.OnActionExecuting(TestHelpers.CreateActionExecutingContext(request, controller)); var testCommand = await controller.GetTestCommand(request); return(testCommand.TestCommand); }
private async Task <string> GetTestCommandArgumentsAsync(string source, TestCommandType testType = TestCommandType.Single) { var workspace = await TestHelpers.CreateSimpleWorkspace(source); var context = new DnxContext(); var projectName = "project.json"; var projectCounter = 1; context.ProjectContextMapping.Add(projectName, projectCounter); context.Projects.Add(projectCounter, new Project { Path = "project.json", Commands = { { "test", "Xunit.KRunner" } } }); ITestCommandProvider testCommandProvider = new DnxTestCommandProvider(context, new FakeEnvironment(), new FakeLoggerFactory(), new NullEventEmitter()); var controller = new TestCommandService(workspace, new [] { testCommandProvider }); var lineColumn = TestHelpers.GetLineAndColumnFromDollar(source); var request = new TestCommandRequest { Line = lineColumn.Line, Column = lineColumn.Column, FileName = "dummy.cs", Buffer = source.Replace("$", ""), Type = testType }; await workspace.BufferManager.UpdateBuffer(request); var testCommand = await controller.Handle(request); return(testCommand.TestCommand); }
public TestCommand(TestCommandType type, IModule module, Option <TestPlanRecorder> recorder, bool throwOnExecute) { this.type = type; this.module = Preconditions.CheckNotNull(module, nameof(module)); this.recorder = recorder; this.throwOnExecute = throwOnExecute; this.CommandExecuted = false; this.CommandUndone = false; }
private HttpMethod GetHttpMethod(TestCommandType type) { switch (type) { case TestCommandType.HttpPut: return(HttpMethod.Put); case TestCommandType.HttpGet: return(HttpMethod.Get); case TestCommandType.HttpPost: return(HttpMethod.Post); case TestCommandType.HttpPatch: return(HttpMethod.Patch); case TestCommandType.HttpDelete: return(HttpMethod.Delete); } throw new ApplicationException("Unexpected HttpMethod type"); }
internal static NativeTypes.FABRIC_TEST_COMMAND_TYPE ToNative(TestCommandType type) { switch (type) { case TestCommandType.PartitionDataLoss: return(NativeTypes.FABRIC_TEST_COMMAND_TYPE.FABRIC_TEST_COMMAND_TYPE_INVOKE_DATA_LOSS); case TestCommandType.PartitionQuorumLoss: return(NativeTypes.FABRIC_TEST_COMMAND_TYPE.FABRIC_TEST_COMMAND_TYPE_INVOKE_QUORUM_LOSS); case TestCommandType.PartitionRestart: return(NativeTypes.FABRIC_TEST_COMMAND_TYPE.FABRIC_TEST_COMMAND_TYPE_INVOKE_RESTART_PARTITION); case TestCommandType.NodeTransition: return(NativeTypes.FABRIC_TEST_COMMAND_TYPE.FABRIC_TEST_COMMAND_TYPE_START_NODE_TRANSITION); default: return(NativeTypes.FABRIC_TEST_COMMAND_TYPE.FABRIC_TEST_COMMAND_TYPE_DEFAULT); } }
private async Task <string> GetTestCommandAsync(string source, TestCommandType testType) { var testFile = new TestFile("dummy.cs", source); SharedOmniSharpTestHost.AddFilesToWorkspace(testFile); var rh = SharedOmniSharpTestHost.GetRequestHandler <TestCommandService>(OmniSharpEndpoints.TestCommand); OmniSharpConfiguration config = new OmniSharpConfiguration() { MSBuildPath = new BuildPath() { Path = "path\\to\\source" }, TestCommands = new TestCommands() { All = "nunit3-console.exe --noresult --noh {{AssemblyPath}}", Single = "nunit3-console.exe --noresult --noh {{AssemblyPath}} --test={{TypeName}}", Fixture = "nunit3-console.exe --noresult --noh {{AssemblyPath}} --test={{TypeName}}" } }; rh._config = config; var cc = rh._config; rh._testCommandProviders.First().testCommands = TestCommandType.All; var point = testFile.Content.GetPointFromPosition(); var requestHandler = GetRequestHandler(SharedOmniSharpTestHost); var request = new TestCommandRequest { Type = testType, Line = point.Line, FileName = testFile.FileName, Buffer = testFile.Content.Code }; var response = await requestHandler.Handle(request); return(response.TestCommand); }
public async Task <TestCommandQueryResult> ProcessGetTestCommandListAsync(TestCommandListDescription description) { // 5728192 const int MaxNumberOfItems = 10000; IEnumerable <ActionStateBase> result = await this.actionStore.GetSelectedActionsAsync(description); List <TestCommandStatus> list = new List <TestCommandStatus>(); int end = Math.Min(result.Count(), MaxNumberOfItems); for (int i = 0; i < end; i++) { TestCommandProgressState state = FaultAnalysisServiceUtility.ConvertState(result.ElementAt(i), TraceType); TestCommandType type = ConvertType(result.ElementAt(i)); list.Add(new TestCommandStatus(result.ElementAt(i).OperationId, state, type)); } TestCommandQueryResult testCommandQueryResult = new TestCommandQueryResult(list); return(testCommandQueryResult); }
public TestCommand(TestCommandType type, IModule module, Option <TestPlanRecorder> recorder) : this(type, module, recorder, false) { }
public TestCommand(TestCommandType type, IModule module) : this(type, module, Option.None <TestPlanRecorder>(), false) { }
public TestRecordType(TestCommandType testType, IModule module) { this.TestType = testType; this.Module = Preconditions.CheckNotNull(module, nameof(module)); }
public TestContext(string projectFile, TestCommandType testCommandType, ISymbol symbol) { ProjectFile = projectFile; TestCommandType = testCommandType; Symbol = symbol; }
internal TestCommandStatus(Guid operationId, TestCommandProgressState actionState, TestCommandType actionType) { this.operationId = operationId; this.state = actionState; this.type = actionType; }
private async Task<string> GetTestCommandArgumentsAsync(string source, TestCommandType testType = TestCommandType.Single) { var workspace = TestHelpers.CreateSimpleWorkspace(source); var context = new DnxContext(); var projectName = "project.json"; var projectCounter = 1; context.ProjectContextMapping.Add(projectName, projectCounter); context.Projects.Add(projectCounter, new Project { Path = "project.json", Commands = { { "test", "Xunit.KRunner" } } }); var testCommandProviders = new[] { new DnxTestCommandProvider(context, new FakeEnvironment(), new FakeLoggerFactory(), new NullEventEmitter(), new FakeOmniSharpOptions()) }; var controller = new TestCommandController(workspace, testCommandProviders); var lineColumn = TestHelpers.GetLineAndColumnFromDollar(source); var request = new TestCommandRequest { Line = lineColumn.Line, Column = lineColumn.Column, FileName = "dummy.cs", Buffer = source.Replace("$", ""), Type = testType }; var bufferFilter = new UpdateBufferFilter(workspace); bufferFilter.OnActionExecuting(TestHelpers.CreateActionExecutingContext(request, controller)); var testCommand = await controller.GetTestCommand(request); return testCommand.TestCommand; }