public void DeleteRepoTest() { var service = new RepoService(_dbContext, _projectService.Object); var fakeUser = _dbContext.Users.FirstOrDefault(user => user.UserName == "Mario"); service.CreateRepo(fakeUser, 998, "RepoToDelete", "Test repo", "http://dev.to"); var res = service.DeleteRepo(_dbContext.Repositories.FirstOrDefault(repo => repo.Id == 998)); Assert.AreEqual(true, res.Result); }
public void CreateRepoTest() { var service = new RepoService(_dbContext, _projectService.Object); var fakeUser = _dbContext.Users.FirstOrDefault(user => user.UserName == "Mario"); service.CreateRepo(fakeUser, 999, "RepoFromHell", "Test repo", "http://2ip.ru"); var repo = service.FindRepo(999); Assert.AreEqual("RepoFromHell", repo.Result.Name); Assert.AreEqual("Test repo", repo.Result.Description); }
public ActionResult <string> Create(Repo repo) { var result = _repoService.CreateRepo(repo); if (result) { return("repo create successfully"); } else { return("repo create unsuccessfully"); } }