public void Analyze_TooShortFileName_CallLogger() { FakeLogger logger = new FakeLogger(); LogAnalyzer5 analyzer5 = new LogAnalyzer5(logger); analyzer5.MinNameLength = 6; analyzer5.Analyze("a.txt"); StringAssert.Contains("too short", logger.LastError); }
public void Analyze_TooShortFileName_CallLogger() { ILogger logger = Substitute.For <ILogger>(); LogAnalyzer5 analyzer5 = new LogAnalyzer5(logger); analyzer5.MinNameLength = 6; analyzer5.Analyze("a.txt"); var ret = ""; logger.TestFlag.Returns(x => { ret = "Test"; return(ret); }); logger.Received().LogError("too short"); Assert.AreEqual(logger.TestFlag, ret); }