コード例 #1
0
        public void ProcessShouldProduceListOfSolutionFilesWithoutExcludes()
        {
            var testData = new List <(string path, SolutionDescription desc)>
            {
                (Path.Combine(BasePath, @"projects-finder\SonarSolutionsAnalyzer.Tests\test.sln"),
                 new SolutionDescription {
                    Name = "test"
                }),
                (Path.Combine(BasePath, @"projects-finder\SonarSolutionsAnalyzer.Tests\test-wt.sln"),
                 new SolutionDescription {
                    Name = "test-wt"
                })
            };
            var solutionBuilderMock = new Mock <ISolutionDescriptorBuilder>();

            foreach (var(path, desc) in testData)
            {
                solutionBuilderMock.Setup(x => x.Build(path)).Returns(desc).Verifiable();
            }

            var target = new SolutionProcessor(new Configuration {
                RootPath = BasePath
            }, solutionBuilderMock.Object, () => testData.Select(x => x.path));
            var result = target.Process();

            Assert.Collection(
                result,
                d => Assert.Equal(d.Name, testData[0].desc.Name),
                d => Assert.Equal(d.Name, testData[1].desc.Name)
                );
            solutionBuilderMock.Verify();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            try
            {
                var cpPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);

                //find the root path of the SamplePackager
                var parent = new DirectoryInfo(cpPath).Parent.Parent.Parent.Parent.Parent;

                //var solutionPath = Path.Combine(parent.FullName, @"TestSolution\SampleApplication\SampleApplication.sln");
                //var solutionPath = Path.Combine(parent.FullName, @"TestSolution2\Samples\SampleApplication.sln");

                var solutionPath = @"C:\Users\dave\Desktop\ARCore\samples\HelloAR.sln";

                var outPutPath = @"C:\SamplePackagerOutput\ARCoreSamples";

                //var packageVersions = new Dictionary<string, string>()
                //{
                //    {"StandardSample","1.1.0" },
                //    {"AndroidLibary","1.1.0" },
                //};

                var outputfile = SolutionProcessor.Process(solutionPath, outPutPath);

                Console.WriteLine("Complete");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.ReadLine();
        }
コード例 #3
0
        public void ProcessShouldProduceListOfSolutionFilesWithIncludes()
        {
            var testData = new List <(string path, SolutionDescription desc)>
            {
                (Path.Combine(BasePath, @"projects-finder\SonarSolutionsAnalyzer.Tests\test.sln"),
                 new SolutionDescription {
                    Name = "test"
                }),
                (Path.Combine(BasePath, @"exclude1\exlude2\SonarSolutionsAnalyzer.Tests\test-wt.sln"),
                 new SolutionDescription {
                    Name = "test-wt"
                }),
                (Path.Combine(BasePath, @"exclude\SonarSolutionsAnalyzer.Tests\test1.sln"),
                 new SolutionDescription {
                    Name = "test1"
                }),
                (Path.Combine(BasePath, @"include2\test2.sln"),
                 new SolutionDescription {
                    Name = "test2"
                })
            };
            var solutionBuilderMock = new Mock <ISolutionDescriptorBuilder>();

            foreach (var(path, desc) in testData)
            {
                solutionBuilderMock.Setup(x => x.Build(path)).Returns(desc);
            }

            var target = new SolutionProcessor(
                new Configuration
            {
                RootPath      = BasePath,
                IncludedPaths = new List <string>
                {
                    Path.Combine(BasePath, @"projects-finder"),
                    @"include2"
                }
            },
                solutionBuilderMock.Object,
                () => testData.Select(x => x.path)
                );

            var result = target.Process().ToList();

            solutionBuilderMock.Verify(x => x.Build(testData[0].path), Times.Once);
            solutionBuilderMock.Verify(x => x.Build(testData[1].path), Times.Never);
            solutionBuilderMock.Verify(x => x.Build(testData[2].path), Times.Never);
            solutionBuilderMock.Verify(x => x.Build(testData[3].path), Times.Once);
            Assert.Collection(
                result,
                d => Assert.Equal(d.Name, testData[0].desc.Name),
                d => Assert.Equal(d.Name, testData[3].desc.Name)
                );
        }