コード例 #1
0
        public async Task FindsCustomWatchItems()
        {
            _tempDir
            .WithCSharpProject("Project1", out var target)
            .WithTargetFrameworks("netcoreapp1.0")
            .WithItem(new ItemSpec {
                Name = "Watch", Include = "*.js", Exclude = "gulpfile.js"
            })
            .Dir()
            .WithFile("Program.cs")
            .WithFile("app.js")
            .WithFile("gulpfile.js");

            var fileset = await GetFileSet(target);

            AssertEx.EqualFileList(
                _tempDir.Root,
                new[]
            {
                "Project1.csproj",
                "Program.cs",
                "app.js"
            },
                fileset
                );
        }
コード例 #2
0
        public async Task ConsoleCancelKey()
        {
            _tempDir
            .WithCSharpProject("testproj")
            .WithTargetFrameworks("netcoreapp3.1")
            .Dir()
            .WithFile("Program.cs")
            .Create();

            var output = new StringBuilder();

            _console.Error = _console.Out = new StringWriter(output);
            using (var app = new Program(_console, _tempDir.Root))
            {
                var run = app.RunAsync(new[] { "run" });

                await _console.CancelKeyPressSubscribed.TimeoutAfter(TimeSpan.FromSeconds(30));

                _console.ConsoleCancelKey();

                var exitCode = await run.TimeoutAfter(TimeSpan.FromSeconds(30));

                Assert.Contains("Shutdown requested. Press Ctrl+C again to force exit.", output.ToString());
                Assert.Equal(0, exitCode);
            }
        }