Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        private async Task <GetTestCommandResponse> GetTestCommandAsync(string source)
        {
            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) };
            var controller           = new TestCommandController(workspace, testCommandProviders);
            var request = CreateRequest(source);

            return(await controller.GetTestCommand(request));
        }
        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;
        }