public IHttpActionResult CreateUser(User u) { using (DAL.UserRepository repo = new DAL.UserRepository(_con)) { repo.Create(UserConverter.ConvertFrom_NoID(u)); } return(Ok()); }
public void UTCreateNewUserShouldFail(string connection) { WebAPI.Models.User u = new WebAPI.Models.User(); u.Username = "******"; u.Password = "******"; //This should have been mocked for the test to actually work. using (DAL.UserRepository repo = new DAL.UserRepository(connection)) { repo.Create(UserConverter.ConvertFrom_NoID(u)); } }
/// <summary> /// Dummy, for testing DB connection. /// </summary> /// <returns></returns> public IHttpActionResult GetCreate() { string conString = "Server=10.108.233.52;" + "Initial Catalog=VortexDB;" + "User Id=sqladmin;" + "Password =Pa$$w0rd;"; using (DAL.UserRepository repo = new DAL.UserRepository(conString)) { repo.Create(UserConverter.ConvertFrom(users[0])); } return(Ok(users[2])); }