public void Update_Called_Via_Service_With_Valid_Data()
        {
            var repo         = new MockUserDbOperation();
            var userServices = new UserServices(repo);
            var user         = new User {
                Id = 1, Name = "Bala", Address = "Mumbai"
            };

            Assert.IsTrue(userServices.Update(user));
        }
        public void Delete_Called_Via_Service_With_Invalid_Data()
        {
            var repo        = new MockUserDbOperation();
            var userService = new UserServices(repo);
            var user        = new User()
            {
                Id = 0
            };

            Assert.IsFalse(userService.Delete(user));
        }
        public void Delete_Called_Via_Service_With_Valid_Data()
        {
            var repo         = new MockUserDbOperation();
            var userServices = new UserServices(repo);
            var user         = new User()
            {
                Id = 4
            };

            Assert.IsTrue(userServices.Delete(user));
        }
        public void Update_Called_Via_Services_With_Invalid_Data_Should_Fail(int id, string newName, string newAddress)
        {
            var repo         = new MockUserDbOperation();
            var userServices = new UserServices(repo);
            var user         = new User {
                Id = id, Name = newName, Address = newAddress
            };


            userServices.Update(user);
        }
        public void Create_User_With_Invalid_Data_Using_Validations_Should_Throw_SqlException(string name,
                                                                                              string address)
        {
            var repo         = new MockUserDbOperation();
            var userServices = new UserServices(repo);
            var user         = new User {
                Name = name, Address = address
            };

            Assert.IsFalse(userServices.Create(user));
        }
        public void Create_User_Via_Service_With_Valid_Data()
        {
            IUserDbOperations repo = new MockUserDbOperation();
            var userServices       = new UserServices(repo);
            var user = new User {
                Name = "Rakesh", Address = "Mumbai"
            };

            userServices.Create(user);

            Assert.IsTrue(user.Id > 0);
        }