public void ControlSameNameExists_EmptyUsersList()
        {
            var errorMessage = string.Empty;
            var userName = "******";
            IEnumerable<User> users = new List<User>();

            var service = new ValidationService();
            var result = service.ControlSameNameExists(userName, users, out errorMessage);

            Assert.IsTrue(result);
            Assert.IsTrue(string.IsNullOrEmpty(errorMessage));
        }
        public void ControlSameNameExists_ItWorksFine()
        {
            var errorMessage = string.Empty;
            var userName = "******";
            IEnumerable<User> users = new List<User>
            {
                new User{ Name = "Gérard" },
                new User{ Name = "Michel" },
                new User{ Name = "Gilbert" },
                new User{ Name = "Bernard" }
            };

            var service = new ValidationService();
            var result = service.ControlSameNameExists(userName, users, out errorMessage);

            Assert.IsTrue(result);
            Assert.IsTrue(string.IsNullOrEmpty(errorMessage));
        }
        public void ControlSameNameExists_SameNameFound()
        {
            var errorMessage = string.Empty;
            var userName = "******";
            IEnumerable<User> users = new List<User>
            {
                new User{ Name = "Gérard" },
                new User{ Name = "Michel" },
                new User{ Name = "Lionel" },
                new User{ Name = "Bernard" }
            };

            var service = new ValidationService();
            var result = service.ControlSameNameExists(userName, users, out errorMessage);

            Assert.IsFalse(result);
            Assert.AreEqual("Le nom existe déjà !", errorMessage);
        }