Пример #1
0
        public void resolve_source_files_dont_exist()
        {
            var fileSystem = new MockFileSystem();
            var rootPath   = fileSystem.AllDirectories.First();
            var srcPath    = fileSystem.Path.Combine(rootPath, "neo", "token-sample", "src");

            fileSystem.Directory.SetCurrentDirectory(srcPath);
            var apocPath = fileSystem.Path.Combine(srcPath, "Apoc.cs");

            var resolver = new DebugInfo.DocumentResolver(ImmutableDictionary <string, string> .Empty, fileSystem);
            var actual   = resolver.ResolveDocument(apocPath);

            Assert.Equal(apocPath, actual);
        }
Пример #2
0
        public void resolve_source_current_directory()
        {
            var fileSystem = new MockFileSystem();
            var rootPath   = fileSystem.AllDirectories.First();
            var srcPath    = fileSystem.Path.Combine(rootPath, "src");

            fileSystem.Directory.SetCurrentDirectory(srcPath);
            var apocPath = fileSystem.Path.Combine(srcPath, "Apoc.cs");

            fileSystem.AddFile(apocPath, MockFileData.NullObject);
            fileSystem.AddFile(fileSystem.Path.Combine(srcPath, "Apoc.Crowdsale.cs"), MockFileData.NullObject);

            var resolver = new DebugInfo.DocumentResolver(ImmutableDictionary <string, string> .Empty, fileSystem);
            var actual   = resolver.ResolveDocument(@"c:\Users\harry\Source\neo\seattle\samples\token-sample\src\Apoc.cs");

            Assert.Equal(apocPath, actual);
        }
Пример #3
0
        public void resolve_source_via_map_2()
        {
            var fileSystem      = new MockFileSystem();
            var rootPath        = fileSystem.AllDirectories.First();
            var tokenSamplePath = fileSystem.Path.Combine(rootPath, "neo", "token-sample");
            var apocPath        = fileSystem.Path.Combine(tokenSamplePath, "src", "Apoc.cs");

            fileSystem.AddFile(apocPath, MockFileData.NullObject);

            var sourceMap = new Dictionary <string, string>
            {
                { @"c:\Users\harry\Source\neo\seattle\samples\token-sample", tokenSamplePath }
            };
            var resolver = new DebugInfo.DocumentResolver(sourceMap, fileSystem);
            var actual   = resolver.ResolveDocument(@"c:\Users\harry\Source\neo\seattle\samples\token-sample\src\Apoc.cs");

            Assert.Equal(apocPath, actual);
        }