public void Open_CurrentExistsFalse_ReturnsNextOpenResult() { // Arrange var currentNode = new DummyResourceResolverNode(); var nextNode = new DummyResourceResolverNode(); currentNode.GetCurrentCacheDependencyMock = (pathDefinition, virtualPath, virtualPathDependencies, utcDate) => null; var currentStream = new MemoryStream(); currentNode.CurrentOpenMock = (pathDefinition, virtualPath) => currentStream; currentNode.CurrentExistsMock = (pathDefinition, virtualPath) => false; var nextCacheDependency = new CacheDependency(Directory.GetCurrentDirectory()); var nextStream = new MemoryStream(); nextNode.CurrentOpenMock = (pathDefinition, virtualPath) => nextStream; nextNode.CurrentExistsMock = (pathDefinition, virtualPath) => true; currentNode.SetNext(nextNode); // Act var result = currentNode.Open(new PathDefinition(), "~/Test"); // Assert Assert.AreSame(nextStream, result, "The returned stream is not that of the second node."); }
/// <summary> /// Sets the next node. /// </summary> /// <param name="currentNode">The current node.</param> /// <returns></returns> private CacheDependency SetNextNode(DummyResourceResolverNode currentNode) { var nextNode = new DummyResourceResolverNode(); var nextCacheDependency = new CacheDependency(Directory.GetCurrentDirectory()); nextNode.GetCurrentCacheDependencyMock = (pathDefinition, virtualPath, virtualPathDependencies, utcDate) => nextCacheDependency; nextNode.CurrentExistsMock = (pathDefinition, virtualPath) => true; currentNode.SetNext(nextNode); return nextCacheDependency; }