コード例 #1
0
        public void ContainerLoadsLoadedAutofacModule()
        {
            var container = ConventionContainerBuilder.BuilderFromModules().Build();

            Assert.That(container, Is.Not.Null);

            var result = container.ResolveNamed <string>("LoadedAutofacModule");

            Assert.That(result, Is.Not.Null);
            Assert.That(result, Is.EqualTo("LoadedAutofacModule"));
        }
コード例 #2
0
        public void ContainerLoadsUnloadedAutofacModule()
        {
            Assert.That(AppDomain.CurrentDomain.GetAssemblies().Any(a => a.GetName().Name == "Utility.Autofac.Test.UnloadedModule"), Is.False);

            var container = ConventionContainerBuilder.BuilderFromModules().Build();

            Assert.That(AppDomain.CurrentDomain.GetAssemblies().Any(a => a.GetName().Name == "Utility.Autofac.Test.UnloadedModule"), Is.True);
            Assert.That(container, Is.Not.Null);

            var result = container.ResolveNamed <string>("UnloadedAutofacModule");

            Assert.That(result, Is.Not.Null);
            Assert.That(result, Is.EqualTo("UnloadedAutofacModule"));
        }