/// <summary> /// Dictionary builder. /// </summary> /// <returns>A dictionary with the first user as admin, rest as users</returns> private static Dictionary <string, IdentityUserRole <string> > InitialzieData() { var allUsers = MockApplicationUsers.GetAll().ToArray(); var mapInitSize = (int)(allUsers.Count() * 1.5); var hashMap = new Dictionary <string, IdentityUserRole <string> >(mapInitSize); var first = true; foreach (var user in allUsers) { if (first) { first = false; hashMap[user.Id] = new IdentityUserRole <string> { UserId = user.Id, RoleId = MockRoles.Admin.Id }; } else { hashMap[user.Id] = new IdentityUserRole <string> { UserId = user.Id, RoleId = MockRoles.User.Id }; } } return(hashMap); }
/// <summary> /// Helper to create todo which handles id and owner. /// </summary> /// <param name="due">The due date</param> /// <param name="description">The description</param> /// <returns>A Todo</returns> private static Todo CreateTodo(DateTime due, string description) { var todo = new Todo { Id = _firstIdRunner, Due = due, Description = description, Owner = MockApplicationUsers.Get((_firstIdRunner >> 1) - (FirstId >> 1)) }; _firstIdRunner++; return(todo); }