public async Task LoadSymbolsAsync()
        {
            var modules = new List <SbModule>()
            {
                Substitute.For <SbModule>(),
                Substitute.For <SbModule>(),
                Substitute.For <SbModule>(),
                Substitute.For <SbModule>(),
            };

            _target.GetNumModules().Returns(modules.Count);
            for (int i = 0; i < modules.Count; i++)
            {
                _target.GetModuleAtIndex(i).Returns(modules[i]);
            }

            var task           = Substitute.For <ICancelable>();
            var symbolSettings =
                new SymbolInclusionSettings(true, new List <string>(), new List <string>());
            var moduleFileLoadRecorder = Substitute.For <IModuleFileLoadMetricsRecorder>();
            await _attachedProgram.LoadModuleFilesAsync(
                symbolSettings, true, task, moduleFileLoadRecorder);

            await _moduleFileLoader.Received(1).LoadModuleFilesAsync(
                Arg.Is <IList <SbModule> >(l => l.SequenceEqual(modules)), symbolSettings, true, task,
                moduleFileLoadRecorder);
        }
        public async Task LoadModuleFilesWithExclusionSettingsAsync()
        {
            SbModule includedModule = CreateMockModule(true, true, "included");
            SbModule excludedModule = CreateMockModule(true, true, "excluded");
            var      modules        = new List <SbModule>()
            {
                includedModule, excludedModule
            };

            bool useIncludeList = false;
            var  excludeList    = new List <string>()
            {
                "excluded"
            };
            var settings =
                new SymbolInclusionSettings(useIncludeList, excludeList, new List <string>());

            Assert.That(
                await moduleFileLoader.LoadModuleFilesAsync(
                    modules, settings, true, mockTask, fakeModuleFileLoadRecorder),
                Is.EqualTo(VSConstants.S_OK));

            await AssertLoadBinaryReceivedAsync(includedModule);
            await AssertLoadSymbolsReceivedAsync(includedModule);
            await AssertLoadBinaryNotReceivedAsync(excludedModule);
            await AssertLoadSymbolsNotReceivedAsync(excludedModule);
        }
Beispiel #3
0
        public void ModuleInclusionCheckReturnsTrueWhenNotInExcludedList()
        {
            bool useIncludeList = false;
            var  settings       = new SymbolInclusionSettings(
                useIncludeList, new List <string>()
            {
                "excludedModule"
            }, new List <string>());

            Assert.That(settings.IsModuleIncluded("someModule"), Is.True);
            Assert.That(settings.IsModuleIncluded("excludedModule"), Is.False);
        }
Beispiel #4
0
        public void ModuleInclusionCheckReturnsTrueWhenInIncludedList()
        {
            bool useIncludeList = true;
            var  settings       = new SymbolInclusionSettings(useIncludeList, new List <string>(),
                                                              new List <string>()
            {
                "includedModule"
            });

            Assert.That(settings.IsModuleIncluded("includedModule"), Is.True);
            Assert.That(settings.IsModuleIncluded("otherModule"), Is.False);
        }
Beispiel #5
0
        public void ModuleInclusionCheckIsCaseInsensitive()
        {
            bool useIncludeList = true;
            var  settings       =
                new SymbolInclusionSettings(useIncludeList, new List <string>(),
                                            new List <string>()
            {
                "includedModule", "oneMore"
            });

            Assert.That(settings.IsModuleIncluded("INCLUDEDMODULE"), Is.True);
            Assert.That(settings.IsModuleIncluded("OnEmOrE"), Is.True);
        }
Beispiel #6
0
        public void ModuleInclusionCheckAcceptsRegex()
        {
            bool useIncludeList = true;
            var  settings       = new SymbolInclusionSettings(useIncludeList, new List <string>(),
                                                              new List <string>()
            {
                "excluded*", "m?dule"
            });

            Assert.That(settings.IsModuleIncluded("excludedModule"), Is.True);
            Assert.That(settings.IsModuleIncluded("excluded"), Is.True);
            Assert.That(settings.IsModuleIncluded("excluded.dll"), Is.True);
            Assert.That(settings.IsModuleIncluded("Module"), Is.True);
            Assert.That(settings.IsModuleIncluded("Moodule"), Is.False);
            Assert.That(settings.IsModuleIncluded("SomeModule"), Is.False);
            Assert.That(settings.IsModuleIncluded("somethingexcluded"), Is.False);
        }