////[TestCase("Alex")] public void GetFirstUserByName_FirstNameAlex_FirstUserWithNameAlex(string name) { User user1 = new User() { FirstName = "Alex", LastName = "Blck", Age = 22 }; User user2 = new User() { FirstName = "Mike", LastName = "red", Age = 123 }; User user3 = new User() { FirstName = "Sue", LastName = "gen", Age = 42 }; User user4 = new User() { FirstName = "Alex", LastName = "Black", Age = 111 }; UserStorageServiceMaster master = new UserStorageServiceMaster(new UserRepositoryWithState(), new List <UserStorageServiceSlave>(new[] { new UserStorageServiceSlave(new UserRepositoryWithState()), new UserStorageServiceSlave(new UserRepositoryWithState()) })); master.Add(user1); master.Add(user2); master.Add(user3); master.Add(user4); Assert.AreEqual(user1, master.GetFirstUserByName(name)); Assert.AreNotEqual(user4, master.GetFirstUserByName(name)); }
public void GetFirstUserByName_FirstNameJohn_Null(string name) { User user1 = new User() { FirstName = "Alex", LastName = "Blck", Age = 22 }; User user2 = new User() { FirstName = "Mike", LastName = "red", Age = 123 }; User user3 = new User() { FirstName = "Sue", LastName = "gen", Age = 42 }; User user4 = new User() { FirstName = "Alex", LastName = "Black", Age = 111 }; UserStorageServiceMaster service = new UserStorageServiceMaster(new UserRepositoryWithState()); service.Add(user1); service.Add(user2); service.Add(user3); service.Add(user4); Assert.AreEqual(null, service.GetFirstUserByName(name)); }
public void GetFirstUserByName_Null_ArgumentNullException() { UserStorageServiceMaster service = new UserStorageServiceMaster(new UserRepositoryWithState()); Assert.Catch <ArgumentNullException>(() => service.GetFirstUserByName(null)); }