public void ControllerShouldBeForAuthorizedUsersOnly() { //Arrange var controller = new RoutesController(null, null, null, null, null); //Act var attributes = controller.GetType().GetCustomAttributes(true); //Assert attributes.Any(a => a.GetType() == typeof(AuthorizeAttribute)); }
public void ControllerShouldBeForUsersInRoleCompany() { //Arrange var controller = new RoutesController(null, null, null, null, null); //Act var attributes = controller.GetType().GetCustomAttributes(true); var authorizeAttribute = attributes.FirstOrDefault(a => a.GetType() == typeof(AuthorizeAttribute)); //Assert authorizeAttribute.As <AuthorizeAttribute>().Roles.Should().Be(Role.Company.ToString()); }
public void ControllerShouldBeInCompanyArea() { //Arrange var controller = new RoutesController(null, null, null, null, null); //Act var attributes = controller.GetType().GetCustomAttributes(true); var areaAttribute = attributes.FirstOrDefault(a => a.GetType() == typeof(AreaAttribute)); //Assert areaAttribute.As <AreaAttribute>().RouteValue.Should().Be(WebConstants.Area.Company); }