public static List1DataSet_ApplicationUserDTO GetInstance(object key, string jbID) { if (key == null) { return(null); } var rawKey = key.ToString(); var parsedKey = (rawKey); var foundEntry = new DAL.Repository().GetById <zAppDev.DotNet.Framework.Identity.Model.ApplicationUser>(parsedKey, false); if (foundEntry == null && !string.IsNullOrWhiteSpace(jbID)) { if (int.TryParse(rawKey, out int _uniqueKey)) { var controller = new UsersListController(); var method = controller.GetType().GetMethod($"Get_{jbID}_DatasourceQueryable"); var records = method.Invoke(controller, new object[] { null }) as IQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationUser>; foundEntry = records.Where(c => c._GetUniqueIdentifier() == _uniqueKey).FirstOrDefault(); } } if (foundEntry != null) { return(new List1DataSet_ApplicationUserDTO(foundEntry)); } return(null); }
public void UsersList_VerifyPaging() { var mvcProxy = new MvcControllerProxy(); mvcProxy.ControllerName = typeof(UsersListController).FullName; var usersListController = new UsersListController(); usersListController.Model.SelectionMode = SelectionMode.AllItems; usersListController.Model.DisplayMode = ListDisplayMode.Paging; usersListController.Model.SortExpression = "FirstName ASC"; usersListController.Model.ItemsPerPage = 1; mvcProxy.Settings = new ControllerSettings(usersListController); var usersPage1 = usersListController.Model.CreateListViewModel(1).Items.ToArray(); Assert.IsTrue(usersPage1.Length.Equals(1), "Number of users is not correct"); Assert.AreEqual(SitefinityAdmin, usersPage1[0].Fields.User.UserName, "Wrong username"); var usersPage2 = usersListController.Model.CreateListViewModel(2).Items.ToArray(); Assert.IsTrue(usersPage2.Length.Equals(1), "Number of users is not correct"); Assert.AreEqual(AdministratorEmail, usersPage2[0].Fields.User.UserName, "Wrong username"); var usersPage3 = usersListController.Model.CreateListViewModel(3).Items.ToArray(); Assert.IsTrue(usersPage3.Length.Equals(1), "Number of users is not correct"); Assert.AreEqual(AuthorEmail, usersPage3[0].Fields.User.UserName, "Wrong username"); }
public void testGetFree() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "testGetFree") .Options; using (var context = new ApplicationDbContext(options)) { context.Users.Add(appU1); context.Users.Add(appU2); context.Users.Add(appU3); context.Users.Add(appU4); context.Users.Add(appU5); context.Users.Add(appU6); context.Students.Add(student1); context.Students.Add(student2); context.Add(worker1); context.Add(worker2); context.Admin.Add(admin1); context.Admin.Add(admin2); context.SaveChanges(); }; using (var context = new ApplicationDbContext(options)) { var service = new UsersListController(context); var result = service.GetFree(); CollectionAssert.AreEqual(result, emptyAppUsers); } }
public static async Task Returns_sorted_list_of_users() { var users = new[] { CreateUser.With(userId: "User1", firstName: "Silvester", lastName: "Probet"), CreateUser.With(userId: "User2", firstName: "Kendricks", lastName: "Hawke"), CreateUser.With(userId: "User3", firstName: "Rupert", lastName: "Trollope"), }; var controller = new UsersListController(CreateUserRepository.WithUsers(users)); var result = await controller.GetAsync(); var resultValue = GetResultValue <UsersListResponse>(result); Assert.NotNull(resultValue.Users); var actualUsers = resultValue.Users.ToArray(); Assert.Equal(3, actualUsers.Length); Assert.Equal("User2", actualUsers[0].UserId); Assert.Equal("Kendricks Hawke", actualUsers[0].Name); Assert.Equal("User1", actualUsers[1].UserId); Assert.Equal("Silvester Probet", actualUsers[1].Name); Assert.Equal("User3", actualUsers[2].UserId); Assert.Equal("Rupert Trollope", actualUsers[2].Name); }
public void RetrieveUsers() { TestUsersListView usersListView = new TestUsersListView(); UsersListController controller = new UsersListController( new ConsoleResponsiveHelper(ConcurrencyMode.Modal), usersListView); controller.RetrieveGroups(); Assert.IsTrue(true, "No Exceptions"); }
public static void Start() { Form1 usersListView = new Form1(); UsersListController controller = new UsersListController( new WinFormsResponsiveHelper(ConcurrencyMode.Modal), usersListView); controller.RetrieveGroups(); Application.Run(usersListView); }
public void SelectGroup() { TestUsersListView usersListView = new TestUsersListView(); UsersListController controller = new UsersListController( new ConsoleResponsiveHelper(ConcurrencyMode.Modal), usersListView); controller.RetrieveGroups(); usersListView.SelectedGroup = usersListView.SharedData.Groups[1]; controller.OnGroupSelectionChanged(usersListView.SelectedGroup); Assert.IsTrue(true, "No Exceptions"); }
public static void startFirstController() { // Gtk version: UsersListView view = new UsersListView(); UsersListController controller = new UsersListController(new GtkResponsiveHelper(ConcurrencyMode.Modal), view); controller.RetrieveGroups(); MainWindow win = new MainWindow (); win.Add((Gtk.Widget)view); win.Show (); win.ReshowWithInitialSize(); win.Child.ShowAll(); }
public void UsersList_VerifyLimit() { var mvcProxy = new MvcControllerProxy(); mvcProxy.ControllerName = typeof(UsersListController).FullName; var usersListController = new UsersListController(); usersListController.Model.SelectionMode = SelectionMode.AllItems; usersListController.Model.DisplayMode = ListDisplayMode.Limit; usersListController.Model.SortExpression = "FirstName ASC"; usersListController.Model.LimitCount = 1; mvcProxy.Settings = new ControllerSettings(usersListController); var users = usersListController.Model.CreateListViewModel(1).Items.ToArray(); Assert.IsTrue(users.Length.Equals(1), "Number of users is not correct"); Assert.AreEqual(SitefinityAdmin, users[0].Fields.User.UserName, "Wrong username"); }
public void UsersList_VerifySortingFirstNameZA() { var mvcProxy = new MvcControllerProxy(); mvcProxy.ControllerName = typeof(UsersListController).FullName; var usersListController = new UsersListController(); usersListController.Model.SelectionMode = SelectionMode.AllItems; usersListController.Model.SortExpression = "FirstName DESC"; mvcProxy.Settings = new ControllerSettings(usersListController); var users = usersListController.Model.CreateListViewModel(1).Items.ToArray(); Assert.IsTrue(users.Length.Equals(3), "Number of users is not correct"); //// expected: test last, fname lname, Admin Admin Assert.AreEqual(AuthorUserName, users[0].Fields.User.UserName, "Wrong username"); Assert.AreEqual(AdministratorUserName, users[1].Fields.User.UserName, "Wrong username"); Assert.AreEqual(SitefinityAdmin, users[2].Fields.User.UserName, "Wrong username"); }
public async Task testGetAll() { getAllList.Add(appU1); getAllList.Add(appU2); var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "testAllTest") .Options; using (var context = new ApplicationDbContext(options)) { context.Users.Add(appU1); context.Users.Add(appU2); context.SaveChanges(); }; using (var context = new ApplicationDbContext(options)) { var service = new UsersListController(context); var result = await service.GetAll(); Assert.AreEqual(getAllList.Count(), result.Count()); } }
public void testUList() { appUList.Add(appU1); appUList.Add(appU2); var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "testUList") .Options; using (var context = new ApplicationDbContext(options)) { context.Users.Add(appU1); context.Users.Add(appU2); context.SaveChanges(); }; using (var context = new ApplicationDbContext(options)) { var service = new UsersListController(context); var result = service.UList(); Assert.AreEqual(appUList.Count(), result.Count()); } }