コード例 #1
0
        public void GetModule_WithPerRequestCollectionTypeDependency_ReturnsDifferentDependencies()
        {
            var bootstrapper = new DefaultNancyBootstrapper();

            bootstrapper.Initialise();
            bootstrapper.GetEngine();

            //var bootstrapper = CreateBootstrapper();

            var firstModule = (SampleModuleWithPerRequestCollectionDependency)bootstrapper.GetModule(
                typeof(SampleModuleWithPerRequestCollectionDependency),
                new NancyContext());

            var secondModule = (SampleModuleWithPerRequestCollectionDependency)bootstrapper.GetModule(
                typeof(SampleModuleWithPerRequestCollectionDependency),
                new NancyContext());

            Assert.IsTrue(firstModule.Instances.SequenceEqual(secondModule.Instances));

            Assert.AreEqual(firstModule.Instances.First(), secondModule.Instances.First());
        }