Пример #1
0
        public void GetAllUsersByFirstNameAndAge_FirstNameAlexLastNameBlack_FirstUserWithFirstNameAlexLastNameBlack(
            string first, int age)
        {
            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 = 22
            };
            User user5 = new User()
            {
                FirstName = "Alex", LastName = "Bra", Age = 32
            };

            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);
            master.Add(user5);

            Assert.AreEqual(new[] { user1, user4 }, master.GetAllUsersByFirstNameAndAge(first, age).Take(2));
        }
Пример #2
0
        ////[TestCase("Alex", 22)]
        public void GetFirstUserByFirstNameAndAge_FirstNameAlexLastNameBlack_FirstUserWithFirstNameAlexLastNameBlack(string first, int age)
        {
            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(new UserRepositoryWithState());

            Assert.AreEqual(user1, service.GetAllUsersByFirstNameAndAge(first, age));
            Assert.AreNotEqual(user4, service.GetAllUsersByFirstNameAndAge(first, age));
        }