public void PushPopTest()
{
CacheRequest defaultCR = CacheRequest.Current;
CacheRequest target = new CacheRequest();
target.TreeScope = TreeScope.Children;
target.Push();
CacheRequest target2 = new CacheRequest();
target2.TreeScope = TreeScope.Subtree;
target2.Push();
// Try to change target2 - this should fail
try
{
target2.TreeScope = TreeScope.Descendants;
Assert.Fail("exception expected");
}
catch (System.InvalidOperationException)
{
}
target2.Pop();
target.Pop();
Assert.AreEqual(CacheRequest.Current, defaultCR);
}