public void TestListen1() { using (var proxy = new LogFileProxy(_scheduler, TimeSpan.Zero, _logFile.Object)) { proxy.AddListener(_listener.Object, TimeSpan.FromSeconds(1), 1000); proxy.OnLogFileModified(_logFile.Object, new LogFileSection(0, 1)); _modifications.Property(x => x.Count).ShouldEventually().Be(2); _modifications.Should().Equal(new[] { LogFileSection.Reset, new LogFileSection(0, 1) }); } }
public void TestListen4() { using (var proxy = new LogFileProxy(_scheduler, TimeSpan.Zero, _logFile.Object)) { proxy.AddListener(_listener.Object, TimeSpan.Zero, 1000); new Action(() => proxy.OnLogFileModified(new Mock<ILogFile>().Object, new LogFileSection(0, 1))).ShouldNotThrow(); _modifications.Should().Equal(new[] { LogFileSection.Reset }, "because the OnLogFileModified shouldn't have been forwarded since it's from the wrong source"); new Action(() => proxy.OnLogFileModified(null, new LogFileSection(0, 1))).ShouldNotThrow(); _modifications.Should().Equal(new[] { LogFileSection.Reset }, "because the OnLogFileModified shouldn't have been forwarded since it's from the wrong source"); } }