Exemple #1
0
        public void Throw_If_Matching_Thread_Isnt_Found()
        {
            // arrange
            var    sut    = new DumpHandleRepository(new Dictionary <ulong, DumpHandle>());
            Action throws = () => sut.Get(0x123414);

            // act
            // assert
            throws.Should().Throw <KeyNotFoundException>();
        }
        /// <summary>
        ///     Registers the repositories.
        /// </summary>
        /// <param name="options">The options.</param>
        public void RegisterRepositories(Options options)
        {
            var objRepo       = new DumpObjectRepository(Objects, Roots, BlockingObjects, FinalizerQueueObjects);
            var typeRepo      = new DumpTypeRepository(Types);
            var threadRepo    = new DumpThreadRepository(Threads);
            var appDomainRepo = new DumpAppDomainRepository(AppDomains);
            var moduleRepo    = new DumpModuleRepository(Modules);
            var handleRepo    = new DumpHandleRepository(Handles);
            var infoRepo      = new DumpInformationRepository(DataTarget, Runtime, DumpFile);

            CompositionContainer.ComposeExportedValue <IDumpObjectRepository>(objRepo);
            CompositionContainer.ComposeExportedValue <IDumpTypeRepository>(typeRepo);
            CompositionContainer.ComposeExportedValue <IDumpThreadRepository>(threadRepo);
            CompositionContainer.ComposeExportedValue <IDumpAppDomainRepository>(appDomainRepo);
            CompositionContainer.ComposeExportedValue <IDumpModuleRepository>(moduleRepo);
            CompositionContainer.ComposeExportedValue <IDumpHandleRepository>(handleRepo);
            CompositionContainer.ComposeExportedValue <IDumpInformationRepository>(infoRepo);
        }
Exemple #3
0
        public void Get_A_Thread_By_Os_Id()
        {
            // arrange
            var dumpHandles = new Dictionary <ulong, DumpHandle>
            {
                [0x42] = new DumpHandle
                {
                    Address = 42
                },
                [0x1337] = new DumpHandle
                {
                    Address = 1337
                }
            };
            var    sut    = new DumpHandleRepository(dumpHandles);
            Action throws = () => sut.Get(0x123123);

            // act
            // assert
            sut.Get(0x42).Should().Be(dumpHandles[0x42]);
            sut.Get(0x1337).Should().Be(dumpHandles[0x1337]);
            sut.Handles.Should().HaveCount(2);
            throws.Should().Throw <KeyNotFoundException>();
        }