public async void AddAbsence(string reason) { var sickness = await _sicknessService.AddAbsence(1, reason, null); Assert.NotNull(sickness); Assert.True(_sicknessService.IsSick(1)); _dbMock.Verify(x => x.SaveChangesAsync(), Times.Once); }
public async Task <IActionResult> Index(Availability availability) { try { await _sicknessService.AddAbsence(int.Parse(Request.Cookies["CurrentUserID"]), availability.Reason, availability.EndTime); } catch (DateHasPassedException) { TempData["DateError"] = "Datum mag niet in het verleden zijn!"; return(View("Index")); } catch (Exception) { TempData["DateError"] = "Er ging iets fout"; return(View("Index")); } return(View("Better")); }