public void BeforeAll() { _solutionName = "MySolution.sln"; _fullFilePath = @"C:\where I am\A Solution\MySolution.sln"; _projectOne = Builder<Project>.CreateNew().Build(); _projectTwo = Builder<Project>.CreateNew().Build(); _nuspec1 = Builder<NuSpecFile>.CreateNew().Build(); _nuspec2 = Builder<NuSpecFile>.CreateNew().Build(); var solutionFileContents = GetSolutionFileContents(); var fileSystem = new Mock<IFileSystem>(); fileSystem.Setup(fs => fs.FindFullFilePath(_solutionName)).Returns(_fullFilePath); fileSystem.Setup(fs => fs.ReadFile(_fullFilePath)).Returns(solutionFileContents); fileSystem.Setup(fs => fs.GetDirectory(_fullFilePath)).Returns(""); var projectBuilder = new Mock<IBuilder<Project, BuildProjectRequest>>(); projectBuilder.Setup(b => b.Build(It.Is<BuildProjectRequest>(projectRequest => projectRequest.ProjectFilePath == "Project1\\Project1.csproj"))).Returns(_projectOne); projectBuilder.Setup(b => b.Build(It.Is<BuildProjectRequest>(projectRequest => projectRequest.ProjectFilePath == "Project2\\Project2.csproj"))).Returns(_projectTwo); var nuspecBuilder = new Mock<IBuilder<NuSpecFile, string>>(); nuspecBuilder.Setup(b => b.Build("spec1")).Returns(_nuspec1); nuspecBuilder.Setup(b => b.Build("spec2")).Returns(_nuspec2); var builder = new SolutionBuilder(fileSystem.Object, projectBuilder.Object, nuspecBuilder.Object); var request = new BuildSolutionRequest() .WithSolutionName(_solutionName) .WithNuSpec("spec1") .WithNuSpec("spec2"); _solution = builder.Build(request); }
public void BeforeAll() { _projectFilePath = @"C:\myproject\myproject.csproj"; _projectDirectory = @"C:\myproject"; _projectName = "What I am called"; _dependencies = Builder<NuGetPackageDependency>.CreateListOfSize(2).Build(); _expectedPackageFilePath = @"C:\myproject\packages.config"; var fileSystem = new Mock<IFileSystem>(); fileSystem.Setup(fs => fs.GetDirectory(_projectFilePath)).Returns(_projectDirectory); var packageBuilder = new Mock<IBuilder<ICollection<NuGetPackageDependency>, string>>(); packageBuilder.Setup(b => b.Build(_expectedPackageFilePath)).Returns(_dependencies); var builder = new ProjectBuilder(fileSystem.Object, packageBuilder.Object); var request = new BuildProjectRequest() .WithProjectFilePath(_projectFilePath) .WithName(_projectName); _project = builder.Build(request); }