Example #1
0
        public void DeleteCompiledFile()
        {
            using (var scenario = new GlobbingAppScenario())
                using (var wait = new WaitForFileToChange(scenario.StartedFile))
                {
                    scenario.Start();

                    var fileToChange = Path.Combine(scenario.TestAppFolder, "include", "Foo.cs");
                    File.Delete(fileToChange);

                    wait.Wait(_defaultTimeout,
                              expectedToChange: true,
                              errorMessage: $"Process did not restart because {scenario.StartedFile} was not changed");
                }
        }
Example #2
0
        public void DeleteSourceFolder()
        {
            using (var scenario = new GlobbingAppScenario())
                using (var wait = new WaitForFileToChange(scenario.StartedFile))
                {
                    scenario.Start();

                    var folderToDelete = Path.Combine(scenario.TestAppFolder, "include");
                    Directory.Delete(folderToDelete, recursive: true);

                    wait.Wait(_defaultTimeout,
                              expectedToChange: true,
                              errorMessage: $"Process did not restart because {scenario.StartedFile} was not changed");
                }
        }
Example #3
0
        public void AddCompiledFile()
        {
            // Add a file in a folder that's included in compilation
            using (var scenario = new GlobbingAppScenario())
                using (var wait = new WaitForFileToChange(scenario.StartedFile))
                {
                    scenario.Start();

                    var fileToChange = Path.Combine(scenario.TestAppFolder, "include", "Bar.cs");
                    File.WriteAllText(fileToChange, "");

                    wait.Wait(_defaultTimeout,
                              expectedToChange: true,
                              errorMessage: $"Process did not restart because {scenario.StartedFile} was not changed");
                }
        }
Example #4
0
        public void AddCompiledFile()
        {
            // Add a file in a folder that's included in compilation
            using (var scenario = new GlobbingAppScenario())
            using (var wait = new WaitForFileToChange(scenario.StartedFile))
            {
                scenario.Start();

                var fileToChange = Path.Combine(scenario.TestAppFolder, "include", "Bar.cs");
                File.WriteAllText(fileToChange, "");

                wait.Wait(_defaultTimeout,
                    expectedToChange: true,
                    errorMessage: $"Process did not restart because {scenario.StartedFile} was not changed");
            }
        }
Example #5
0
        // Change a file included in compilation
        private void ChangeCompiledFile(bool usePollingWatcher)
        {
            using (var scenario = new GlobbingAppScenario())
                using (var wait = new WaitForFileToChange(scenario.StartedFile))
                {
                    scenario.UsePollingWatcher = usePollingWatcher;

                    scenario.Start();

                    var fileToChange = Path.Combine(scenario.TestAppFolder, "include", "Foo.cs");
                    var programCs    = File.ReadAllText(fileToChange);
                    File.WriteAllText(fileToChange, programCs);

                    wait.Wait(_defaultTimeout,
                              expectedToChange: true,
                              errorMessage: $"Process did not restart because {scenario.StartedFile} was not changed");
                }
        }
Example #6
0
        public void ChangeExcludedFile()
        {
            using (var scenario = new GlobbingAppScenario())
            {
                scenario.Start();

                var ids    = File.ReadAllLines(scenario.StatusFile);
                var procId = int.Parse(ids[0]);

                var changedFile = Path.Combine(scenario.TestAppFolder, "exclude", "Baz.cs");
                File.WriteAllText(changedFile, "");

                Console.WriteLine($"Waiting {_negativeTestWaitTime.TotalSeconds} seconds to see if the app restarts");
                Waiters.WaitForProcessToStop(
                    procId,
                    _negativeTestWaitTime,
                    expectedToStop: false,
                    errorMessage: "Test app restarted");
            }
        }
Example #7
0
        public void ChangeExcludedFile()
        {
            using (var scenario = new GlobbingAppScenario())
            {
                scenario.Start();

                var ids = File.ReadAllLines(scenario.StatusFile);
                var procId = int.Parse(ids[0]);

                var changedFile = Path.Combine(scenario.TestAppFolder, "exclude", "Baz.cs");
                File.WriteAllText(changedFile, "");

                Console.WriteLine($"Waiting {_negativeTestWaitTime.TotalSeconds} seconds to see if the app restarts");
                Waiters.WaitForProcessToStop(
                    procId,
                    _negativeTestWaitTime,
                    expectedToStop: false,
                    errorMessage: "Test app restarted");
            }
        }
Example #8
0
        // Add a file that's in a included folder but not matching the globbing pattern
        private void ChangeNonCompiledFile(bool usePollingWatcher)
        {
            using (var scenario = new GlobbingAppScenario())
            {
                scenario.UsePollingWatcher = usePollingWatcher;

                scenario.Start();

                var ids    = File.ReadAllLines(scenario.StatusFile);
                var procId = int.Parse(ids[0]);

                var changedFile = Path.Combine(scenario.TestAppFolder, "include", "not_compiled.css");
                File.WriteAllText(changedFile, "");

                Console.WriteLine($"Waiting {_negativeTestWaitTime.TotalSeconds} seconds to see if the app restarts");
                Waiters.WaitForProcessToStop(
                    procId,
                    _negativeTestWaitTime,
                    expectedToStop: false,
                    errorMessage: "Test app restarted");
            }
        }
Example #9
0
        public void DeleteCompiledFile()
        {
            using (var scenario = new GlobbingAppScenario())
            using (var wait = new WaitForFileToChange(scenario.StartedFile))
            {
                scenario.Start();

                var fileToChange = Path.Combine(scenario.TestAppFolder, "include", "Foo.cs");
                File.Delete(fileToChange);

                wait.Wait(_defaultTimeout,
                    expectedToChange: true,
                    errorMessage: $"Process did not restart because {scenario.StartedFile} was not changed");
            }
        }
Example #10
0
        // Add a file that's in a included folder but not matching the globbing pattern
        private void ChangeNonCompiledFile(bool usePollingWatcher)
        {
            using (var scenario = new GlobbingAppScenario())
            {
                scenario.UsePollingWatcher = usePollingWatcher;

                scenario.Start();

                var ids = File.ReadAllLines(scenario.StatusFile);
                var procId = int.Parse(ids[0]);

                var changedFile = Path.Combine(scenario.TestAppFolder, "include", "not_compiled.css");
                File.WriteAllText(changedFile, "");

                Console.WriteLine($"Waiting {_negativeTestWaitTime.TotalSeconds} seconds to see if the app restarts");
                Waiters.WaitForProcessToStop(
                    procId,
                    _negativeTestWaitTime,
                    expectedToStop: false,
                    errorMessage: "Test app restarted");
            }
        }
Example #11
0
        // Change a file included in compilation
        private void ChangeCompiledFile(bool usePollingWatcher)
        {
            using (var scenario = new GlobbingAppScenario())
            using (var wait = new WaitForFileToChange(scenario.StartedFile))
            {
                scenario.UsePollingWatcher = usePollingWatcher;

                scenario.Start();

                var fileToChange = Path.Combine(scenario.TestAppFolder, "include", "Foo.cs");
                var programCs = File.ReadAllText(fileToChange);
                File.WriteAllText(fileToChange, programCs);

                wait.Wait(_defaultTimeout,
                    expectedToChange: true,
                    errorMessage: $"Process did not restart because {scenario.StartedFile} was not changed");
            }
        }
Example #12
0
        public void DeleteSourceFolder()
        {
            using (var scenario = new GlobbingAppScenario())
            using (var wait = new WaitForFileToChange(scenario.StartedFile))
            {
                scenario.Start();

                var folderToDelete = Path.Combine(scenario.TestAppFolder, "include");
                Directory.Delete(folderToDelete, recursive: true);

                wait.Wait(_defaultTimeout,
                    expectedToChange: true,
                    errorMessage: $"Process did not restart because {scenario.StartedFile} was not changed");
            }
        }