Пример #1
0
        public void Lookup_SystemData_Succeeds()
        {
            var expectedModule = typeof(System.Data.DataTable).Assembly.ManifestModule;
            var lookup         = ModuleLookup.Get(expectedModule.ModuleVersionId);

            Assert.Equal(expectedModule, lookup);
        }
Пример #2
0
        public void Lookup_DatadogTrace_Succeeds()
        {
            var expectedModule = typeof(Span).Assembly.ManifestModule;
            var lookup         = ModuleLookup.Get(expectedModule.ModuleVersionId);

            Assert.Equal(expectedModule, lookup);
        }
Пример #3
0
        public void Lookup_Self_Succeeds()
        {
            var expectedModule = typeof(ModuleLookupTests).Assembly.ManifestModule;
            var lookup         = ModuleLookup.Get(expectedModule.ModuleVersionId);

            Assert.Equal(expectedModule, lookup);
        }
Пример #4
0
        public void Lookup_DatadogTraceClrProfilerManaged_Succeeds()
        {
            var expectedModule = typeof(MethodBuilder <>).Assembly.ManifestModule;
            var lookup         = ModuleLookup.Get(expectedModule.ModuleVersionId);

            Assert.Equal(expectedModule, lookup);
        }
Пример #5
0
        public void Lookup_SystemData_Succeeds_WithTwentyConcurrentTries()
        {
            var tasks          = new Task[20];
            var resetEvent     = new ManualResetEventSlim(initialState: false);
            var bag            = new ConcurrentBag <Module>();
            var systemDataGuid = typeof(System.Data.DataTable).Assembly.ManifestModule.ModuleVersionId;

            for (var i = 0; i < 20; i++)
            {
                tasks[i] = Task.Run(() =>
                {
                    resetEvent.Wait();
                    bag.Add(ModuleLookup.Get(systemDataGuid));
                });
            }

            resetEvent.Set();

            Task.WaitAll(tasks);

            Assert.True(bag.All(m => m.ModuleVersionId == systemDataGuid) && bag.Count() == tasks.Length);
        }