public void MetaManagerTest_HandleMessage_ExceptionWhenGetMetaCount() { // Arrange _metaLoggerMock.Setup(x => x.Log(LogLevel.Critical, It.IsAny <EventId>(), It.IsAny <FormattedLogValues>(), It.IsAny <Exception>(), It.IsAny <Func <object, Exception, string> >())); _aggregationManagerMock.Setup(x => x.AddToMetaRepo(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>())); _aggregationManagerMock.Setup(x => x.GetMetaCount(It.IsAny <string>())).Throws(new Exception()); _aggregationManagerMock.Setup(x => x.EnrichAndSendMessage(It.IsAny <string>(), It.IsAny <Guid>(), It.IsAny <int>(), It.IsAny <string>())); String badMessage = ""; MetaManager objectUnderTest = new MetaManager(_metaLoggerMock.Object, _configMock.Object, _aggregationManagerMock.Object); // Action var result = objectUnderTest.HandleMessage("247d7eb3-2fbe-4b3c-84ef-f3580f5c6331", "Blah blah"); // Assert _metaLoggerMock.Verify(x => x.Log(LogLevel.Critical, It.IsAny <EventId>(), It.IsAny <FormattedLogValues>(), It.IsAny <Exception>(), It.IsAny <Func <object, Exception, string> >()), Times.Once()); _aggregationManagerMock.Verify(x => x.GetMetaCount(It.IsAny <string>()), Times.Once()); _aggregationManagerMock.Verify(x => x.AddToMetaRepo(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>()), Times.Never()); _aggregationManagerMock.Verify(x => x.EnrichAndSendMessage(It.IsAny <string>(), It.IsAny <Guid>(), It.IsAny <int>(), It.IsAny <string>()), Times.Never()); }