示例#1
0
        public static void BeforeAll(TestContext context)
        {
            var solutionBuilder = new SolutionBuilder();
            var request         = new BuildSolutionRequest()
                                  .WithSolutionName("NuGetSolutionValidator")
                                  .WithProjects(p => p.Name != "NugetSolutionValidator.Tests")
                                  .WithNuSpec("NuGetSolutionValidator.NUnit")
                                  .WithNuSpec("NuGetSolutionValidator.Xunit")
                                  .WithNuSpec("NuGetSolutionValidator.MSTest");

            _solution = solutionBuilder.Build(request);
        }
示例#2
0
        public void BeforeAll()
        {
            var solutionBuilder = new SolutionBuilder();
            var request         = new BuildSolutionRequest()
                                  .WithSolutionName("NuGetSolutionValidator")
                                  .WithProjects(p => p.Name.Contains("SampleProject"))
                                  //.WithNuSpec("NuGetSolutionValidator")
                                  //.WithNuSpecProjectSet("NuGetSolutionValidator", new[] { "NuGetSolutionValidator.NUnit" })
            ;

            _solution = solutionBuilder.Build(request);
        }
示例#3
0
        public NuGetValidationTests(ITestOutputHelper logger)
        {
            _logger = logger;
            var solutionBuilder = new SolutionBuilder();
            var request         = new BuildSolutionRequest()
                                  .WithSolutionName("NuGetSolutionValidator")
                                  .WithProjects(p => p.Name != "NugetSolutionValidator.Tests")
                                  .WithNuSpec("NuGetSolutionValidator.NUnit")
                                  .WithNuSpec("NuGetSolutionValidator.Xunit")
                                  .WithNuSpec("NuGetSolutionValidator.MSTest");

            _solution = solutionBuilder.Build(request);
        }
示例#4
0
        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);
        }