public void Changed_will_also_eject_the_header_values_out_of_the_header_cache() { var hash1 = "12345"; var hash2 = "23456"; theCache.LinkFilesToResource(hash1, new AssetFile[] { file1, file2, file3 }); theCache.LinkFilesToResource(hash2, new AssetFile[] { file2, file3, file4 }); theCache.Changed(file1); headersCache.AssertWasCalled(x => x.Eject(hash1)); theOutputCache.AssertWasCalled(x => x.Eject(hash1)); theCache.Changed(file2); }
public void link_files_the_clear_cache() { theCache.LinkFilesToResource(resource1, new AssetFile[] { file1, file2 }); theCache.LinkFilesToResource(resource2, new AssetFile[] { file1, file2, file3 }); theCache.LinkFilesToResource(resource3, new AssetFile[] { file2, file3, file4 }); var output1A = storeAgainstResource(resource1); var output2A = storeAgainstResource(resource2); var output3A = storeAgainstResource(resource3); Func <IRecordedOutput> shouldNotBeCalled = () => { Assert.Fail("Do not call me"); return(null); }; // 2nd pass theCache.Retrieve(resource1, shouldNotBeCalled).ShouldBeTheSameAs(output1A); theCache.Retrieve(resource2, shouldNotBeCalled).ShouldBeTheSameAs(output2A); theCache.Retrieve(resource3, shouldNotBeCalled).ShouldBeTheSameAs(output3A); theCache.Changed(file1); var output1B = getOutputWithEtag("2345"); var output2B = getOutputWithEtag("23456"); var output3B = getOutputWithEtag("23457"); theCache.Retrieve(resource1, () => output1B).ShouldBeTheSameAs(output1B); theCache.Retrieve(resource1, shouldNotBeCalled).ShouldBeTheSameAs(output1B); theCache.Retrieve(resource1, shouldNotBeCalled).ShouldBeTheSameAs(output1B); theCache.Retrieve(resource2, () => output2B).ShouldBeTheSameAs(output2B); theCache.Current(resource2).ShouldEqual("23456"); // Was not cleared because it does not depend on file1 theCache.Retrieve(resource3, shouldNotBeCalled).ShouldBeTheSameAs(output3A); }