Exemplo n.º 1
0
        public void SecurityPluginBuildMenuTest()
        {
            Menu menu = new Menu();
            SecurityPlugin plugin = new SecurityPlugin();

            menu.Add(plugin.BuildMenuItems());

            Assert.AreEqual(menu.Items.Count(), 1);
            //Assert.That(menu.Items[0].Text == "Security");
            //Assert.That(menu.Items[0].Controller == "Security");
            //Assert.That(menu.Items[0].Action == "Index");
        }
Exemplo n.º 2
0
 public void BuildMenu(Menu menu)
 {
     // do not add menu item for testing service
     //menu.Add(new MenuItem("Testing", "Training", "Index"));
 }
Exemplo n.º 3
0
        public void BuildMenu(Menu menu)
        {

        }
Exemplo n.º 4
0
 public void BuildMenu(Menu menu)
 {
     menu.Add(new MenuItem("Security", "Security", "Index"));
 }
Exemplo n.º 5
0
        public void GenerateMenuUsingRoleNone()
        {
            var httpRequest = new HttpRequest(string.Empty, "http://mySomething/", string.Empty);
            var stringWriter = new StringWriter();
            var httpResponce = new HttpResponse(stringWriter);

            // httpResponce.Filter = new FileStream("asd.pdo",FileMode.CreateNew);
            var httpConextMock = new HttpContext(httpRequest, httpResponce);

            HttpContext.Current = httpConextMock;
            var menu = new Menu();
            var menu1 = new Menu();
            container = new WindsorContainer();

            // HttpContext.Current = new HttpContext(new HttpRequest("", "http://iudico.com", null), new HttpResponse(new StreamWriter("mayBeDeleted.txt")));
            InitializeWindsor(ref container);

            service = container.Resolve<ILmsService>();
            PluginController.LmsService = service;
            var plugins = container.ResolveAll<IPlugin>();
            var actions = new Dictionary<IPlugin, IEnumerable<Action>>();
            var roles = new List<Role> { Role.None };

            var currentRole = from rol in roles select rol;
            var userServiceMock = new Mock<IUserService>();
            userServiceMock.Setup(item => item.GetCurrentUserRoles()).Returns(currentRole);
            var userServiceVar = service.FindService<IUserService>();
            userServiceVar = userServiceMock.Object;
            var lmsservice = new Mock<ILmsService>();
            lmsservice.Setup(item => item.FindService<IUserService>()).Returns(userServiceMock.Object);
            var acct = new AccountController(new DatabaseUserStorage(service));
            lmsservice.Setup(item => item.GetMenu()).Returns(menu);

            try
            {
                service = lmsservice.Object;
                service.Inform(LMSNotifications.ApplicationRequestStart);
            }
            catch (Exception)
            {
            }

            foreach (var plugin in plugins)
            {
                menu.Add(plugin.BuildMenuItems().Where(m => this.IsAllowed(m.Controller, m.Action, roles)));
            }

            foreach (var plugin in plugins)
            {
                var menu11 = plugin.BuildMenuItems();

                foreach (var menu2 in menu.Items)
                {
                    if (menu11.Count(item => item == menu2) == 0)
                    {
                        Assert.Fail("Iterms mismatch");
                    }
                }
            }
        }
Exemplo n.º 6
0
        protected void LoadPluginData()
        {
            Menu = new Menu();

            var plugins = Container.ResolveAll<IPlugin>();

            foreach (var plugin in plugins)
            {
                plugin.BuildMenu(Menu);
            }
        }
Exemplo n.º 7
0
 public void BuildMenu(Menu menu)
 {
     menu.Add(new MenuItem(IUDICO.CourseManagement.Localization.getMessage("Courses"), "Course", "Index"));
 }
Exemplo n.º 8
0
        protected void LoadPluginData()
        {
            Menu = new Menu();
            _AllActions = new Dictionary<IPlugin, IEnumerable<IAction>>();

            var plugins = Container.ResolveAll<IPlugin>();

            foreach (var plugin in plugins)
            {
                plugin.BuildMenu(Menu);

                _AllActions.Add(plugin,
                        plugin.BuildActions());
            }
        }
Exemplo n.º 9
0
 public void BuildMenu(Menu menu)
 {
     menu.Add(new MenuItem(IUDICO.UserManagement.Localization.getMessage("Account"), "Account", "Index"));
     menu.Add(new MenuItem(IUDICO.UserManagement.Localization.getMessage("Users"), "User", "Index"));
     menu.Add(new MenuItem(IUDICO.UserManagement.Localization.getMessage("Groups"), "Group", "Index"));
 }
Exemplo n.º 10
0
 public void BuildMenu(Menu menu)
 {
     menu.Add(new MenuItem(IUDICO.Statistics.Localization.getMessage("Statistics"), "Stats", "Index"));
 }
Exemplo n.º 11
0
 public void BuildMenu(Menu menu)
 {
     menu.Add(new MenuItem("Analytics", "Analytics", "Index"));
 }
Exemplo n.º 12
0
 public void BuildMenu(Menu menu)
 {
     menu.Add(new MenuItem(IUDICO.CurriculumManagement.Localization.getMessage("Curriculums"), "Curriculum", "Index"));
 }