Esempio n. 1
0
        public async Task ExecutionTestAsync()
        {
            // Arrange
            StandardProcess Process  = new StandardProcess();
            Template        Template = InitializeTemplates.Templates[1];

            ProjectName     = "TestProject";
            OutputDirectory = tempPath;
            directories.Add("artifacts");
            directories.Add("build");
            directories.Add("docs");
            directories.Add("lib");
            directories.Add("samples");
            directories.Add("packages");
            directories.Add("test");
            Directory.CreateDirectory(tempPath);
            NetCommand = $" new {Template.ShortName}  -o src/ {ProjectName} -n {ProjectName}";
            var Structuring = new Structuring(Process);

            // Act
            logging.WireEventHandlers(Structuring);
            await Structuring.RunStructuringAsync(OutputDirectory, directories, NetCommand, ProjectName);

            await Structuring.RunStructuringAsync(OutputDirectory, directories, NetCommand, ProjectName);

            // Assert
            Assert.Equal("A Project with this Name already exists!", logging.CurrentLog);

            // Cleanup
            logging.CurrentLog = string.Empty;
            Directory.Delete(tempPath, true);
        }
Esempio n. 2
0
        public async Task TestTemplatesAsync(Template Template)
        {
            // Arrange
            TestProcess Process = new TestProcess();

            ProjectName     = "TestProject";
            OutputDirectory = tempPath;
            directories.Add("artifacts");
            directories.Add("build");
            directories.Add("docs");
            directories.Add("lib");
            directories.Add("samples");
            directories.Add("packages");
            directories.Add("test");
            Directory.CreateDirectory(tempPath);
            NetCommand = $" new {Template.ShortName}  -o src/ {ProjectName} -n {ProjectName}";
            var Structuring = new Structuring(Process);

            // Act
            logging.WireEventHandlers(Structuring);
            await Structuring.RunStructuringAsync(OutputDirectory, directories, NetCommand, ProjectName);

            // Assert
            Assert.Equal("dotnet", Process.StartInfo.FileName);
            Assert.Contains($"new {Template.ShortName}", Process.StartInfo.Arguments);

            // Cleanup
            logging.CurrentLog = string.Empty;
            Directory.Delete(tempPath, true);
        }
        public async void ExecButton_Click(object sender, RoutedEventArgs e)
        {
            StandardProcess process = new StandardProcess();

            OutputBox.Text = "";
            Structuring OutputLogs = new Structuring(process);

            this.Dispatcher.Invoke(() =>
            {
                pbStatus.IsIndeterminate = true;
                Style style    = this.FindResource("ProgressBarWarningStripe") as Style;
                pbStatus.Style = style;
            });
            WireEventHandlers(OutputLogs);
            await OutputLogs.RunStructuringAsync(FolderPath, Directories, NetCommand, ProjectName);
        }
Esempio n. 4
0
        public static void Run(string template, string name, string output, bool artifacts, bool build, bool docs, bool lib, bool samples, bool packages, bool test)
        {
            string NETCommand;

            if (artifacts)
            {
                Directories.Add("artifacts");
            }
            if (build)
            {
                Directories.Add("build");
            }
            if (docs)
            {
                Directories.Add("docs");
            }
            if (lib)
            {
                Directories.Add("lib");
            }
            if (samples)
            {
                Directories.Add("samples");
            }
            if (packages)
            {
                Directories.Add("packages");
            }
            if (test)
            {
                Directories.Add("test");
            }

            NETCommand = $" new {template} -o src/{name} -n {name}";
            StandardProcess process = new StandardProcess();
            Structuring     execute = new Structuring(process);

            WireEventHandlers(execute);
            execute.RunStructuringAsync(output, Directories, NETCommand, name).Wait();
        }