public async Task SetAdminEndDateAsyncTest_ReturnsClubAdministrationDto() { //Arrange _repoWrapper .Setup(s => s.ClubAdministration.GetFirstOrDefaultAsync( It.IsAny <Expression <Func <ClubAdministration, bool> > >(), null)) .ReturnsAsync(new ClubAdministration()); _mapper .Setup(s => s.Map <ClubAdministration, ClubAdministrationDTO>(It.IsAny <ClubAdministration>())) .Returns(new ClubAdministrationDTO()); //Act var result = await _clubAdministrationService.SetAdminEndDateAsync(It.IsAny <int>(), It.IsAny <DateTime>()); //Assert _repoWrapper.Verify(i => i.ClubAdministration.Update(It.IsAny <ClubAdministration>()), Times.Once()); _repoWrapper.Verify(r => r.SaveAsync(), Times.Once()); Assert.IsType <ClubAdministrationDTO>(result); }
public async Task <int> AddEndDate(int clubAdministrationId, [FromBody] DateTime endDate) { try { await _clubAdministrationService.SetAdminEndDateAsync(clubAdministrationId, endDate); return(1); } catch (Exception) { return(0); } }
public async Task <IActionResult> SetClubAdministratorEndDate(int clubAdministrationId, DateTime endDate) { return(Ok(await _clubAdministrationService.SetAdminEndDateAsync(clubAdministrationId, endDate))); }