public async Task TestUpdate() { Mock <IDateRepository> mock = new Mock <IDateRepository>(); DateMobileController controller = new DateMobileController(mock.Object); DateMobile date = new DateMobile() { Id = new Guid() }; date.NumarDate = 100; mock.Setup(t => t.Update(It.IsAny <DateMobile>())).Verifiable(); await controller.UpdateDate(date); mock.VerifyAll(); }
public async Task TestUpdateDateMobileNull() { Mock <IDateRepository> mock = new Mock <IDateRepository>(); DateMobileController controller = new DateMobileController(mock.Object); DateMobile date = null; ArgumentNullException exception = await Assert.ThrowsExceptionAsync <ArgumentNullException>(() => controller.UpdateDate(date)); Assert.AreEqual(exception.ParamName, nameof(date)); }