Fixing the build break.

This commit is contained in:
sornaks 2015-04-08 14:20:09 -07:00
parent b08a2154c1
commit 645b82d194
3 changed files with 2 additions and 33 deletions

View File

@ -228,30 +228,6 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
Assert.Equal(expected2, response2.Trim());
}
[Fact]
public async Task CacheTagHelper_Activated_BasedOnEnabledParameter()
{
// Arrange
var server = TestHelper.CreateServer(_app, SiteName, _configureServices);
var client = server.CreateClient();
client.BaseAddress = new Uri("http://localhost");
// Act
// This is cached for 1s.
var response1 = await client.GetStringAsync("/catalog/31");
var response2 = await client.GetStringAsync("/catalog/32");
// This request is made before the cache expires with enabled set to false.
client.DefaultRequestHeaders.Remove("IsCacheEnabled");
client.DefaultRequestHeaders.Add("IsCacheEnabled", "false");
var response3 = await client.GetStringAsync("/catalog/156");
// Assert
Assert.Equal("Cached content for 31", response1.Trim());
Assert.Equal("Cached content for 31", response2.Trim());
Assert.Equal("Cached content for 156", response3.Trim());
}
[Fact]
public async Task CacheTagHelper_UsesVaryByCookie_ToVaryContent()
{

View File

@ -23,15 +23,8 @@ namespace MvcTagHelpersWebSite.Controllers
}
[HttpGet("/catalog/{id:int}")]
public ViewResult Details(int id, [FromHeader] string isCacheEnabled)
public ViewResult Details(int id)
{
bool cacheEnabledHeader = true;
if (!string.IsNullOrEmpty(isCacheEnabled))
{
bool.TryParse(isCacheEnabled, out cacheEnabledHeader);
}
ViewBag.IsCacheEnabled = cacheEnabledHeader;
ViewData["ProductId"] = id;
return View();
}

View File

@ -1,4 +1,4 @@
@using Microsoft.Framework.Caching.Memory
<cache expires-after="TimeSpan.FromSeconds(1)" priority="CachePreservationPriority.Low" enabled="ViewBag.IsCacheEnabled">
<cache expires-after="TimeSpan.FromSeconds(1)" priority="CachePreservationPriority.Low">
Cached content for @ViewBag.ProductId
</cache>