public void Throw_If_Does_Not_Exist() { // arrange var modules = new Dictionary <DumpModuleKey, DumpModule> { }; var sut = new DumpModuleRepository(modules); Action mightThrow = () => sut.Get(12, ""); // act // assert mightThrow.Should().Throw <KeyNotFoundException>(); }
public void Return_The_Correct_Value() { // arrange var a = new DumpModule(new DumpModuleKey(0, "0")); var b = new DumpModule(new DumpModuleKey(1, "1")); var modules = new Dictionary <DumpModuleKey, DumpModule> { [a.Key] = a, [b.Key] = b }; var sut = new DumpModuleRepository(modules); // act // assert sut.Get(0, "0").Should().Be(a); sut.Modules.Should().HaveCount(2); }
/// <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); }