Пример #1
0
        // [TestCase("Alex", "Black")]
        public void GetFirstUserByFirstAndLastName_FirstNameAlexLastNameBlack_FirstUserWithFirstNameAlexLastNameBlack(
            string first, string last)
        {
            User user1 = new User()
            {
                FirstName = "Alex", LastName = "Black", 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(null);

            service.Add(user1);
            service.Add(user2);
            service.Add(user3);
            service.Add(user4);

            Assert.AreEqual(user1, service.GetAllUsersByFirstAndLastName(first, last));
            Assert.AreNotEqual(user4, service.GetAllUsersByFirstAndLastName(first, last));
        }
Пример #2
0
        public void GetAllUsersByFirstAndLastName_FirstNameAlexLastNameBlack_FirstUserWithFirstNameAlexLastNameBlack(
            string first, string last)
        {
            User user1 = new User()
            {
                FirstName = "Alex", LastName = "Black", 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(new[] { user1, user4 }, master.GetAllUsersByFirstAndLastName(first, last).Take(2));
        }