Example #1
0
        public void ShouldThrowMeaningfulExceptionWhenRuntimeTargetIsMissing()
        {
            using (var projectFolder = new DisposableFolder())
            {
                ProcessHelper.RunAndCaptureOutput("dotnet", "new console -n SampleLibrary", projectFolder.Path);
                ProcessHelper.RunAndCaptureOutput("dotnet", "restore", projectFolder.Path);
                var pathToAssetsFile   = Path.Combine(projectFolder.Path, "SampleLibrary", "obj", "project.assets.json");
                var dependencyResolver = new ScriptDependencyContextReader(TestOutputHelper.CreateTestLogFactory());

                var exception = Assert.Throws <InvalidOperationException>(() => dependencyResolver.ReadDependencyContext(pathToAssetsFile));
                Assert.Contains("Make sure that the project file was restored using a RID (runtime identifier).", exception.Message);
            }
        }
Example #2
0
 private ScriptParser CreateParser()
 {
     return(new ScriptParser(TestOutputHelper.CreateTestLogFactory()));
 }
        private CompilationDependencyResolver CreateCompilationDependencyResolver()
        {
            var resolver = new CompilationDependencyResolver(TestOutputHelper.CreateTestLogFactory());

            return(resolver);
        }
Example #4
0
 static ScriptTestRunner()
 {
     // Redirect log messages to the test output window when running in process (DEBUG)
     Program.CreateLogFactory = (verbosity, debugMode) => TestOutputHelper.CreateTestLogFactory();
 }
Example #5
0
        private RuntimeDependencyResolver CreateRuntimeDependencyResolver()
        {
            var resolver = new RuntimeDependencyResolver(TestOutputHelper.CreateTestLogFactory(), useRestoreCache: false);

            return(resolver);
        }
Example #6
0
 private LogFactory GetLogFactory()
 {
     return(TestOutputHelper.CreateTestLogFactory());
 }
Example #7
0
        private ScriptProjectProvider CreateProvider()
        {
            ScriptProjectProvider provider = new ScriptProjectProvider(TestOutputHelper.CreateTestLogFactory());

            return(provider);
        }