private void TestExceptions() { var mockException = new Mock <IQueueTypeRepository>(); mockException.Setup(x => x.FindAll()).Throws(new Exception()); mockException.Setup(x => x.FindById(It.IsAny <int>())).Throws(new Exception()); mockException.Setup(x => x.Create(It.IsAny <QueueType>())).Throws(new Exception()); mockException.Setup(x => x.Update(It.IsAny <QueueType>())).Throws(new Exception()); mockException.Setup(x => x.Delete(It.IsAny <QueueType>())).Throws(new Exception()); var queueTypeRepository = mockException.Object; var queueTypeService = new QueueTypeService(queueTypeRepository); Assert.Throws <Exception>(() => queueTypeService.FindAll()); Assert.Throws <Exception>(() => queueTypeService.FindById(1)); Assert.Throws <Exception>(() => queueTypeService.Update(new QueueType())); Assert.Throws <Exception>(() => queueTypeService.Create(new QueueType())); Assert.Throws <Exception>(() => queueTypeService.Delete(new QueueType())); }
private void TestCreate() { var queueTypeService = new QueueTypeService(_queueTypeRepository); Assert.Equal(_queueTypes[0], queueTypeService.Create(new QueueType())); }