예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        public ActionResult <string> Create(Repo repo)
        {
            var result = _repoService.CreateRepo(repo);

            if (result)
            {
                return("repo create successfully");
            }
            else
            {
                return("repo create unsuccessfully");
            }
        }