예제 #1
0
        public void ModuleManager_Raises_InvalidOperationException_If_Module_Does_Not_Have_An_Entry_Point_On_Initialize()
        {
            var assembly = typeof(Mock).Assembly;

            LoaderMock.Setup(l => l.Load()).Returns(new[]
            {
                new ModuleContainer {
                    Assembly = assembly
                },
            });

            AssertRaise <InvalidOperationException>(() => ModuleManager.Initialize());
        }
예제 #2
0
        public void ModuleManager_Can_Be_Initialized()
        {
            var assembly = GetType().Assembly;

            TypeManagerMock.Setup(tm => tm.GetEntryPointType(assembly)).Returns(typeof(ModuleStub));

            LoaderMock.Setup(l => l.Load()).Returns(new[]
            {
                new ModuleContainer {
                    Assembly = assembly
                }
            });

            ModuleManager.Initialize();
            var module = ModuleManager.Modules.FirstOrDefault()?.Instance as ModuleStub;

            Assert.IsNotNull(module);
        }