public void LogCriticalAsync_WithoutException_ArgumentNullException_Message() { // Arrange var vsaMock = new Mock <IVisualStudioAccess>(); ILogger logger = new VisualStudioLogger(vsaMock.Object, "foo"); // Act & Assert // ReSharper disable once AssignNullToNotNullAttribute Assert.Throws <ArgumentNullException>(() => logger.LogCriticalAsync(null)); }
public async Task LogCriticalAsync_WithoutException_LogCorrectMessageAsync() { // Arrange var vsaMock = new Mock <IVisualStudioAccess>(); ILogger logger = new VisualStudioLogger(vsaMock.Object, "foo"); // Act await logger.LogCriticalAsync("test message"); // Assert vsaMock.Verify(m => m.LogToOutputPanelAsync("CRITICAL: test message"), Times.Once); }
public async Task LogCriticalAsync_WithException_LogCorrectMessageAsync() { // Arrange var vsaMock = new Mock <IVisualStudioAccess>(); ILogger logger = new VisualStudioLogger(vsaMock.Object, "foo"); var exception = new Exception("test exception"); // Act await logger.LogCriticalAsync(exception, "test message"); // Assert vsaMock.Verify(m => m.LogToOutputPanelAsync(It.Is <string>(s => s.StartsWith("CRITICAL: test message") && s.Contains(exception.Message) && s.Contains(exception.GetType().FullName))), Times.Once); }