public void Throw_If_Matching_Thread_Isnt_Found() { // arrange var repo = new DumpThreadRepository(new Dictionary <uint, DumpThread>()); Action throws = () => repo.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); }
public void Get_A_Thread_By_Os_Id() { // arrange var threads = new Dictionary <uint, DumpThread> { [0x42] = new DumpThread { OsId = 42 }, [0x1337] = new DumpThread { OsId = 1337 } }; var sut = new DumpThreadRepository(threads); Action throws = () => sut.Get(0x123123); // act // assert sut.Get(0x42).Should().Be(threads[0x42]); sut.Get(0x1337).Should().Be(threads[0x1337]); sut.Threads.Should().HaveCount(2); throws.Should().Throw <KeyNotFoundException>(); }