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"); }
public void BuildMenu(Menu menu) { menu.Add(new MenuItem("Security", "Security", "Index")); }
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"); } } } }
public void BuildMenu(Menu menu) { menu.Add(new MenuItem(IUDICO.CourseManagement.Localization.getMessage("Courses"), "Course", "Index")); }
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")); }
public void BuildMenu(Menu menu) { menu.Add(new MenuItem(IUDICO.Statistics.Localization.getMessage("Statistics"), "Stats", "Index")); }
public void BuildMenu(Menu menu) { menu.Add(new MenuItem("Analytics", "Analytics", "Index")); }
public void BuildMenu(Menu menu) { menu.Add(new MenuItem(IUDICO.CurriculumManagement.Localization.getMessage("Curriculums"), "Curriculum", "Index")); }