public void BulkUpdateUsers_Pass() { // Arrange List <User> users = new List <User>(); // Users to update in DB User u1 = new User(1, null, null, null, "password", null, "User", false, null); User u2 = new User(2, null, null, null, "123", null, "User", false, null); User u3 = new User(3, null, null, null, "", null, "User", false, null); User u4 = new User(4, null, null, null, null, null, "User", false, null); User u5 = new User(5, null, null, null, "bad", null, "User", false, null); User u6 = new User(6, null, null, null, "brian", null, "User", false, null); // User performing operation User thisUser = new User(112, null, null, null, "meMEeiaj093QNGEJOW~~~", null, "System Admin", true, null); users.Add(u1); users.Add(u2); users.Add(u3); users.Add(u4); users.Add(u5); users.Add(u6); var um = new UserManagementManager(); // Act um.BulkCreateUsers(thisUser, users, false); List <List <User> > expected = new List <List <User> >() { users, // Passed ID's new List <User>() { } // Failed ID's }; string nameChange = "Bob"; foreach (User u in users) { u.FirstName = nameChange; } List <List <User> > actual = um.BulkUpdateUsers(thisUser, users, "FirstName"); // Assert CollectionAssert.AreEqual(expected[0], actual[0]); CollectionAssert.AreEqual(expected[1], actual[1]); }
public void BulkCreateUsers_PasswordCheck_Pass() { // Arrange List <User> users = new List <User>(); // Initializing User objects to test // Users to insert into DB User u1 = new User(3, null, null, null, "8*3kmmrMropongig", null, "User", false, null); User u2 = new User(4, null, null, null, "meMEeiaj093QNGEJOW~~~", null, "User", false, null); // User performing operation User thisUser = new User(104, null, null, null, "meMEeiaj093QNGEJOW~~~", null, "System Admin", true, null); users.Add(u1); users.Add(u2); Stopwatch stopwatch = new Stopwatch(); List <List <User> > expected = new List <List <User> >() { users, // Passed ID's new List <User>() { } // Failed ID's }; // Act stopwatch.Start(); List <List <User> > actual = _userManagementManager.BulkCreateUsers(thisUser, users, true); stopwatch.Stop(); Console.WriteLine("Elapsed = {0} ms", stopwatch.ElapsedMilliseconds); // Assert CollectionAssert.AreEqual(expected[0], actual[0]); CollectionAssert.AreEqual(expected[1], actual[1]); }