Ejemplo n.º 1
0
        public void GetCacheDependency_ReturnsStrategysGetCacheDependncyResult()
        {
            using (new ObjectFactoryContainerRegion())
            {
                ObjectFactory.Container.RegisterType <IResourceResolverStrategy, DummyResolverStrategy>(new ContainerControlledLifetimeManager());
                var strategy = (DummyResolverStrategy)ObjectFactory.Resolve <IResourceResolverStrategy>();

                var strategyCacheDependency = new CacheDependency(Directory.GetCurrentDirectory());
                strategy.GetCacheDependencyMock = (definition, virtualPath, virtualPathDependencies, utcStart) => strategyCacheDependency;

                var resolver = new ResourceResolver();
                var result   = resolver.GetCacheDependency(new PathDefinition(), "~/Test", null, DateTime.UtcNow);

                Assert.AreSame(strategyCacheDependency, result, "GetCacheDependency did not return the dependency that was provided by the resource resolver strategy.");
            }
        }