public void simple_add_exception_to_CriticalErrorCollector() { CriticalErrorCollector c = new CriticalErrorCollector(); Assert.Throws<ArgumentNullException>( () => c.Add( null, "" ) ); Assert.DoesNotThrow( () => c.Add( new Exception( "A" ), null ) ); c.Add( new Exception( "B" ), "Comment" ); var errors = c.ToArray(); Assert.That( errors[0].ToString(), Is.EqualTo( " - A" ) ); Assert.That( errors[1].ToString(), Is.EqualTo( "Comment - B" ) ); }
public void simple_add_exception_to_CriticalErrorCollector() { CriticalErrorCollector c = new CriticalErrorCollector(); c.Invoking(sut => sut.Add(null, "")).Should().Throw <ArgumentNullException>(); c.Add(new Exception("A"), null); c.Add(new Exception("B"), "Comment"); var errors = c.ToArray(); errors[0].ToString().Should().Be(" - A"); errors[1].ToString().Should().Be("Comment - B"); }
public void simple_add_exception_to_CriticalErrorCollector() { CriticalErrorCollector c = new CriticalErrorCollector(); Assert.Throws <ArgumentNullException>(() => c.Add(null, "")); Assert.DoesNotThrow(() => c.Add(new Exception("A"), null)); c.Add(new Exception("B"), "Comment"); var errors = c.ToArray(); Assert.That(errors[0].ToString(), Is.EqualTo(" - A")); Assert.That(errors[1].ToString(), Is.EqualTo("Comment - B")); }