public async Task TestCreateMinute() { Mock <IMinuteRepository> mock = new Mock <IMinuteRepository>(); MinuteController controller = new MinuteController(mock.Object); Minute minute = new Minute() { Id = new Guid() }; mock.Setup(t => t.Insert(It.IsAny <Minute>())).Verifiable(); await controller.AddMinute(minute); mock.VerifyAll(); }
public async Task TestCreateMinuteNull() { Mock <IMinuteRepository> mock = new Mock <IMinuteRepository>(); MinuteController controller = new MinuteController(mock.Object); Minute minute = null; ArgumentNullException exception = await Assert.ThrowsExceptionAsync <ArgumentNullException>(() => controller.AddMinute(minute)); Assert.AreEqual(exception.ParamName, nameof(minute)); }