예제 #1
0
    public void Create(IOutput output, string?path = null, bool overwrite = false)
    {
        if (output is not ISolution solution)
        {
            throw new NotSupportedException($"{nameof(CreateSolution)} only supports {SupportedType.FullName} output types.");
        }

        path ??= string.Empty;
        if (solution.Directory != null && !Path.IsPathRooted(solution.Directory))
        {
            solution.Directory = Path.Combine(path, solution.Directory);
        }

        if (!string.IsNullOrWhiteSpace(solution.Directory))
        {
            var s = new DirectoryInfo(solution.Directory);
            if (!s.Exists)
            {
                s.Create();
            }
        }

        foreach (var file in solution.Files)
        {
            var fileOutput = new CreateFile(_fileWriter);
            fileOutput.Create(file, path);
        }

        foreach (var project in solution.Projects)
        {
            var projectOutput = new CreateProject(_fileWriter);
            projectOutput.Create(project, path);
        }
    }
예제 #2
0
    public void CreateProject_Create_ThrowsWithSnippet()
    {
        var writer = Substitute.For <IFileWriter>();
        var output = Substitute.For <ISnippet>();

        var sut = new CreateProject(writer);

        var act = () => sut.Create(output);

        act.Should().Throw <NotSupportedException>();
    }
        public async Task Prep(CancellationToken cancel)
        {
            DeleteEntireDirectory.DeleteEntireFolder(Pathing.BaseFolder);
            FileSystem.Directory.CreateDirectory(Pathing.BaseFolder);
            CreateSolutionFile.Create(Pathing.SolutionFile);
            CreateProject.Create(GameCategory.Skyrim, Pathing.ProjectFile, insertOldVersion: true, targetFramework: "net5.0");
            AddProjectToSolution.Add(Pathing.SolutionFile, Pathing.ProjectFile);

            await _processRunner.Run(
                _dotNetCommandStartConstructor.Construct("restore", Pathing.ProjectFile),
                cancel : cancel).ConfigureAwait(false);
        }
예제 #4
0
    public void CreateProject_Create_WritesFile()
    {
        var writer    = Substitute.For <IFileWriter>();
        var fileGroup = Substitute.For <IFileGroup>();

        fileGroup.Name.Returns("fg");
        var file = Substitute.For <IFile>();

        file.Path = "fg\\f";
        file.Name.Returns("f.cs");
        var output = Substitute.For <IProject>();

        output.Path = "c:\\test";
        fileGroup.Files.Returns(new[] { file });
        output.FileGroups.Returns(new[] { fileGroup });
        output.Path = "c:\\test";

        var sut = new CreateProject(writer);

        sut.Create(output);

        writer.Received().Write(file);
        file.Path.Should().Be("c:\\test\\fg\\f");
    }
 public void TestCreateNoPermission32()
 {
     CreateProject.Create("testproject", @"C:\Windows\System32\TestProject");
 }
 public void TestCreateOK()
 {
     CreateProject.Create("testproject", @"Model\TestCreate\");
     LoadSave.DeleteOriginalFolder(@"Model\TestCreate\");
 }