コード例 #1
0
        public void Throw_If_Does_Not_Exist()
        {
            // arrange
            var dumpTypes = new Dictionary <DumpTypeKey, DumpType>
            {
            };
            var    sut        = new DumpTypeRepository(dumpTypes);
            Action mightThrow = () => sut.Get(new DumpTypeKey(12, "12"));

            // act
            // assert
            mightThrow.Should().Throw <KeyNotFoundException>();
        }
コード例 #2
0
        public void Return_The_Correct_Value()
        {
            // arrange
            var a         = new DumpType(new DumpTypeKey(0, "0"));
            var b         = new DumpType(new DumpTypeKey(1, "1"));
            var dumpTypes = new Dictionary <DumpTypeKey, DumpType>
            {
                [a.Key] = a,
                [b.Key] = b
            };
            var sut = new DumpTypeRepository(dumpTypes);

            // act
            // assert
            sut.Get(new DumpTypeKey(0, "0")).Should().Be(a);
            sut.Types.Should().HaveCount(2);
        }
コード例 #3
0
        /// <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);
        }