public void ConfigurationIsMutable()
        {
            var first = new V8Configuration();
            var second = first.AddScriptSearchPath("foo");

            Assert.Same(first, second);
        }
        public void FileScriptLoaderLoadsFilesFromSearchPathsInOrder(string searchPaths, string expectedText)
        {
            var configuration = new V8Configuration();

            foreach (var path in searchPaths.Split(','))
            {
                configuration.AddScriptSearchPath(path);
            }

            var sut = new FileScriptLoader()
            {
                Configuration = configuration
            };

            var result = sut.Load("innerScript.js");

            Assert.Equal(expectedText, result);
        }
        public void FileScriptLoaderThrowsWhenItFailsToLoadFile(string scriptName, string searchFolders, string pathsConsidered)
        {
            var paths = searchFolders.Split(',');
            var configuration = new V8Configuration();

            foreach (var path in paths)
            {
                configuration.AddScriptSearchPath(path);
            }

            var sut = new FileScriptLoader()
            {
                Configuration = configuration
            };

            var exception = Assert.Throws<ScriptLoadException>(() => sut.Load(scriptName));

            var expectedText = "Could not find script " + scriptName + ". Paths considered:\r\n" + 
                string.Join("\r\n", pathsConsidered.Split(',')
                .Select(x => Environment.CurrentDirectory + "\\" + x));

            Assert.Equal(expectedText, exception.Message);
        }