Beispiel #1
0
        public void GetUserById()
        {
            IUsersRepository userRepository = new UsersRepositoryVk();
            UserService      userService    = new UserService(userRepository);

            User user = userService.GetUserById("154951306");

            Assert.AreEqual("Аня", user.FirstName);
            Assert.AreEqual("Зановская", user.LastName);
        }
Beispiel #2
0
        public void GetUserFromRepositoryTest()//тестируем репозиторий с помощью мокСервера
        {
            IUsersRepository userRepository = new UsersRepositoryVk();

            userRepository.baseURL = "http://localhost:8080/method/";
            User user = userRepository.GetUserById("86031446");

            Assert.AreEqual("86031446", user.id);
            Assert.AreEqual("Ирина", user.first_name);
            Assert.AreEqual("Пересыпкина", user.last_name);
            Assert.AreEqual("1.6.1998", user.bdate);
            Assert.AreEqual(false, user.is_closed);
        }
Beispiel #3
0
        public void GetUserAndDefineLeapYearById()
        {
            IUsersRepository userRepository = new UsersRepositoryVk();

            userRepository.URL = "https://api.vk.com/method/";
            UserService userService = new UserService(userRepository);
            string      leapYear    = userService.CheckLeapYear("86031446");

            Assert.AreEqual("Невисокосный", leapYear);

            leapYear = userService.CheckLeapYear("225915811");
            Assert.AreEqual("Високосный", leapYear);
        }
Beispiel #4
0
        public void GetUserFromRepositoryTest()//тес юзер репозитория с помощью мок сервера
        {
            IUsersRepository userRepository = new UsersRepositoryVk();

            userRepository.URL = "http://localhost:8080/method/";
            User user = userRepository.GetUserById("261163818");

            Assert.AreEqual("261163818", user.id);
            Assert.AreEqual("Денис", user.first_name);
            Assert.AreEqual("Иванов", user.last_name);
            Assert.AreEqual("28.2.1998", user.birthday);
            Assert.AreEqual(false, user.is_closed);
        }
Beispiel #5
0
        public void GetUserById()
        {
            IUsersRepository userRepository = new UsersRepositoryVk();

            userRepository.baseURL = "https://api.vk.com/method/";
            UserService userService = new UserService(userRepository);
            int         age         = userService.GetAge("86031446");

            Assert.AreEqual(21, age);

            // User user = userRepository.GetUserById("86031446");
            // Assert.AreEqual("Ирина", user.first_name);
            // Assert.AreEqual("Пересыпкина",user.last_name);
            // Assert.AreEqual("1.6.1998",user.bdate);
        }