public void IsValidForRequestThrowsIfControllerContextIsNull() { // Arrange AjaxOnlyAttribute attr = new AjaxOnlyAttribute(); // Act & assert Assert.ThrowsArgumentNull( delegate { attr.IsValidForRequest(null, null); }, "controllerContext"); }
public void IsValidForRequestReturnsTrueIfHeaderIsPresent() { // Arrange AjaxOnlyAttribute attr = new AjaxOnlyAttribute(); ControllerContext controllerContext = GetControllerContext(containsHeader: true); // Act bool isValid = attr.IsValidForRequest(controllerContext, null); // Assert Assert.True(isValid); }