public async Task TestUpdate() { Mock <IMinuteRepository> mock = new Mock <IMinuteRepository>(); MinuteController controller = new MinuteController(mock.Object); Minute minute = new Minute() { Id = new Guid() }; minute.NumarMinute = 100; mock.Setup(t => t.Update(It.IsAny <Minute>())).Verifiable(); await controller.UpdateMinute(minute); mock.VerifyAll(); }
public async Task TestUpdateMinuteNull() { Mock <IMinuteRepository> mock = new Mock <IMinuteRepository>(); MinuteController controller = new MinuteController(mock.Object); Minute minute = null; ArgumentNullException exception = await Assert.ThrowsExceptionAsync <ArgumentNullException>(() => controller.UpdateMinute(minute)); Assert.AreEqual(exception.ParamName, nameof(minute)); }