Esempio n. 1
0
        public void AddOutputFileHandlesBadPaths()
        {
            var outputFolderPredictions = new List <string>();
            var predictionFailures      = new ConcurrentQueue <(string predictorName, string failure)>();
            var collector = new MsBuildOutputPredictionCollector(outputFolderPredictions, predictionFailures);

            collector.AddOutputFile("!@#$%^&*()\0", TemporaryDirectory, "Mock");

            Assert.Equal(0, outputFolderPredictions.Count);

            Assert.Equal(1, predictionFailures.Count);
            Assert.Equal("Mock", predictionFailures.Single().predictorName);
            Assert.Contains("!@#$%^&*()\0", predictionFailures.Single().failure);
        }
Esempio n. 2
0
        public void AddOutputFileHandlesAbsolutePaths()
        {
            string absoluteDirectoryPath = Path.Combine(TemporaryDirectory, Guid.NewGuid().ToString());
            string absoluteFilePath      = Path.Combine(absoluteDirectoryPath, Guid.NewGuid().ToString());

            var outputFolderPredictions = new List <string>();
            var predictionFailures      = new ConcurrentQueue <(string predictorName, string failure)>();
            var collector = new MsBuildOutputPredictionCollector(outputFolderPredictions, predictionFailures);

            collector.AddOutputFile(absoluteFilePath, TemporaryDirectory, "Mock");

            Assert.Equal(1, outputFolderPredictions.Count);
            Assert.Contains(absoluteDirectoryPath, outputFolderPredictions);

            Assert.Equal(0, predictionFailures.Count);
        }