public async void GetByID_Test(string ms_dv, string expected) { DonVi donVi = new DonVi() { MS_DV = "1102000000", TenDonVi = "PHÒNG CÔNG NGHỆ THÔNG TIN" }; _mockUnitOfWork.Setup(u => u.DonViRepository.GetById(It.IsAny <string>())).Returns(Task.FromResult(donVi)); DonViDTO actual = await _donViService.GetByID(ms_dv); Assert.Equal(expected, actual.MS_DV); }
public async Task <ActionResult> Update(string ms_dv) { if (ms_dv == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DonViDTO donViDTO = await _donViService.GetByID(ms_dv); if (donViDTO == null) { return(HttpNotFound()); } return(View(donViDTO)); }