public void AddProject_Success() { var options = new AddProjectOptions() { Title = "SAds222ad", Description = "sd1111asdasd" }; var result = prsv_.CreateProject(options); Assert.NotNull(result); }
public Project CreateProject(AddProjectOptions options) { if (options == null) { return(null); } if (string.IsNullOrWhiteSpace(options.Title)) { return(null); } if (string.IsNullOrWhiteSpace(options.Description)) { return(null); } if (options.Budget <= 0) { return(null); } //if (options.Creator == null) { // return null; //} var newProject = new Project() { budget = options.Budget, Description = options.Description, Title = options.Title, }; context.Add(newProject); try { context.SaveChanges(); Console.WriteLine("ok project"); } catch (Exception ex) { Console.WriteLine("fail add project"); Console.WriteLine(ex); return(null); } return(newProject); }