public void ControllerShouldBeForAuthorizedUsers()
        {
            //Arrange
            var controller = new AdminCompaniesController(null);

            //Act
            var attributes = controller.GetType().GetCustomAttributes(true);

            //Assert
            attributes.Any(a => a.GetType() == typeof(AuthorizeAttribute));
        }
        public void ControllerShouldBeForAdminsOnly()
        {
            //Arrange
            var controller = new AdminCompaniesController(null);

            //Act
            var attributes = controller.GetType().GetCustomAttributes(true);

            //Assert
            var authorizeAttribute = attributes.FirstOrDefault(a => a.GetType() == typeof(AuthorizeAttribute)).As <AuthorizeAttribute>();

            authorizeAttribute.Roles.Should().Be(Role.Administrator.ToString());
        }
        public void ControllerShouldBeInAdminArea()
        {
            //Arrange
            var controller = new AdminCompaniesController(null);

            //Act
            var attributes = controller.GetType().GetCustomAttributes(true);

            //Assert
            attributes.Any(a => a.GetType() == typeof(AreaAttribute));
            var areaAttribute = attributes.FirstOrDefault(a => a.GetType() == typeof(AreaAttribute));

            areaAttribute.As <AreaAttribute>().RouteValue.Should().Be(WebConstants.Area.Admin);
        }