public void TestCount() { using (var proxy = new LogSourceProxy(_taskScheduler, TimeSpan.Zero, _logFile.Object)) { _logFile.Setup(x => x.GetAllProperties(It.IsAny <IPropertiesBuffer>())) .Callback((IPropertiesBuffer destination) => destination.SetValue(Core.Properties.LogEntryCount, 42)); _taskScheduler.RunOnce(); proxy.GetProperty(Core.Properties.LogEntryCount).Should().Be(42); _logFile.Setup(x => x.GetAllProperties(It.IsAny <IPropertiesBuffer>())) .Callback((IPropertiesBuffer destination) => destination.SetValue(Core.Properties.LogEntryCount, 9001)); _taskScheduler.RunOnce(); proxy.GetProperty(Core.Properties.LogEntryCount).Should().Be(9001); } }
public void TestProgress2() { var logFile = new LogSourceProxy(_taskScheduler, TimeSpan.Zero); _logFile.Setup(x => x.GetAllProperties(It.IsAny <IPropertiesBuffer>())) .Callback((IPropertiesBuffer destination) => { destination.SetValue(Core.Properties.PercentageProcessed, Percentage.FiftyPercent); }); logFile.InnerLogSource = _logFile.Object; logFile.GetProperty(Core.Properties.PercentageProcessed).Should() .Be(Percentage.Zero, "because the proxy didn't process anything just yet"); _taskScheduler.RunOnce(); logFile.GetProperty(Core.Properties.PercentageProcessed).Should() .Be(Percentage.FiftyPercent, "because while the proxy is done, its source is only half finished"); }
public void TestMaxCharactersPerLine() { using (var proxy = new LogSourceProxy(_taskScheduler, TimeSpan.Zero, _logFile.Object)) { _logFile.Setup(x => x.GetAllProperties(It.IsAny <IPropertiesBuffer>())) .Callback((IPropertiesBuffer destination) => { destination.SetValue(TextProperties.MaxCharactersInLine, 101); }); _taskScheduler.RunOnce(); proxy.GetProperty(TextProperties.MaxCharactersInLine).Should().Be(101); _logFile.Setup(x => x.GetAllProperties(It.IsAny <IPropertiesBuffer>())) .Callback((IPropertiesBuffer destination) => { destination.SetValue(TextProperties.MaxCharactersInLine, 0); }); _taskScheduler.RunOnce(); proxy.GetProperty(TextProperties.MaxCharactersInLine).Should().Be(0); } }
public void TestStartTimestamp() { using (var proxy = new LogSourceProxy(_taskScheduler, TimeSpan.Zero, _logFile.Object)) { _logFile.Setup(x => x.GetAllProperties(It.IsAny <IPropertiesBuffer>())) .Callback((IPropertiesBuffer destination) => { destination.SetValue(Core.Properties.StartTimestamp, new DateTime(2016, 10, 7, 14, 46, 00)); }); _taskScheduler.RunOnce(); proxy.GetProperty(Core.Properties.StartTimestamp).Should().Be(new DateTime(2016, 10, 7, 14, 46, 00)); _logFile.Setup(x => x.GetAllProperties(It.IsAny <IPropertiesBuffer>())) .Callback((IPropertiesBuffer destination) => { destination.SetValue(Core.Properties.StartTimestamp, null); }); _taskScheduler.RunOnce(); proxy.GetProperty(Core.Properties.StartTimestamp).Should().NotHaveValue(); } }
public void TestFileSize() { using (var proxy = new LogSourceProxy(_taskScheduler, TimeSpan.Zero, _logFile.Object)) { _logFile.Setup(x => x.GetAllProperties(It.IsAny <IPropertiesBuffer>())) .Callback((IPropertiesBuffer destination) => { destination.SetValue(Core.Properties.Size, Size.FromBytes(12)); }); _taskScheduler.RunOnce(); proxy.GetProperty(Core.Properties.Size).Should().Be(Size.FromBytes(12)); _logFile.Setup(x => x.GetAllProperties(It.IsAny <IPropertiesBuffer>())) .Callback((IPropertiesBuffer destination) => { destination.SetValue(Core.Properties.Size, Size.OneMegabyte); }); _taskScheduler.RunOnce(); proxy.GetProperty(Core.Properties.Size).Should().Be(Size.OneMegabyte); } }
public void TestExists() { using (var proxy = new LogSourceProxy(_taskScheduler, TimeSpan.Zero, _logFile.Object)) { _logFile.Setup(x => x.GetAllProperties(It.IsAny <IPropertiesBuffer>())) .Callback((IPropertiesBuffer destination) => { destination.SetValue(Core.Properties.EmptyReason, null); }); _taskScheduler.RunOnce(); proxy.GetProperty(Core.Properties.EmptyReason).Should().Be(null); var emptyReason = new Mock <IEmptyReason>(); _logFile.Setup(x => x.GetAllProperties(It.IsAny <IPropertiesBuffer>())) .Callback((IPropertiesBuffer destination) => { destination.SetValue(Core.Properties.EmptyReason, emptyReason.Object); }); _taskScheduler.RunOnce(); proxy.GetProperty(Core.Properties.EmptyReason).Should().Be(emptyReason.Object); } }
public void TestEmptyConstruction() { using (var proxy = new LogSourceProxy(_taskScheduler, TimeSpan.Zero)) { proxy.InnerLogSource.Should().BeNull(); proxy.GetProperty(TextProperties.MaxCharactersInLine).Should().Be(0); proxy.GetProperty(Core.Properties.EmptyReason).Should().Be(null); proxy.GetProperty(Core.Properties.Size).Should().BeNull(); proxy.GetProperty(Core.Properties.StartTimestamp).Should().NotHaveValue(); proxy.GetProperty(Core.Properties.EndTimestamp).Should().NotHaveValue(); proxy.GetProperty(Core.Properties.LogEntryCount).Should().Be(0); proxy.Columns.Should().Equal(Core.Columns.Minimum); proxy.GetEntry(0).Index.Should().Be(LogLineIndex.Invalid); } }
public void TestProgress1() { var logFile = new LogSourceProxy(_taskScheduler, TimeSpan.Zero); logFile.GetProperty(Core.Properties.PercentageProcessed).Should().Be(Percentage.Zero); }