public void ExpensesController_ShouldHaveOneAuthorizeAttribute() { // Arrange var expensesController = new ExpensesController(expenseServiceMock.Object, mappingServiceMock.Object, webHelperMock.Object); // Act var result = expensesController.GetType().GetCustomAttributes(typeof(AuthorizeAttribute), false).Length; // Assert Assert.That(result == 1); }
public void Pay_ShouldHaveValidateAntiForgeryTokenAttribute() { // Arrange var expensesController = new ExpensesController(expenseServiceMock.Object, mappingServiceMock.Object, webHelperMock.Object); // Act var result = expensesController.GetType().GetMethod("Pay", new Type[] { typeof(ExpenseViewModel) }) .GetCustomAttributes(typeof(ValidateAntiForgeryTokenAttribute), false).Length; // Assert Assert.That(result == 1); }