public void TestLogEntryIndex_ColumnAvailable() { var entry = new Mock <IReadOnlyLogEntry>(); var view = new ReadOnlyLogEntryView(entry.Object, Core.Columns.LogEntryIndex); entry.SetupGet(x => x.LogEntryIndex).Returns(new LogEntryIndex(101)); view.LogEntryIndex.Should().Be(new LogEntryIndex(101)); }
public void TestDeltaTime_ColumnAvailable() { var entry = new Mock <IReadOnlyLogEntry>(); var view = new ReadOnlyLogEntryView(entry.Object, Core.Columns.DeltaTime); entry.SetupGet(x => x.DeltaTime).Returns(TimeSpan.FromSeconds(42)); view.DeltaTime.Should().Be(TimeSpan.FromSeconds(42)); }
public void TestRawContent_ColumnAvailable() { var entry = new Mock <IReadOnlyLogEntry>(); var view = new ReadOnlyLogEntryView(entry.Object, Core.Columns.RawContent); entry.SetupGet(x => x.RawContent).Returns("I want a clondyke bar, I'm hungry"); view.RawContent.Should().Be("I want a clondyke bar, I'm hungry"); }
public void TestTimestamp_ColumnAvailable() { var entry = new Mock <IReadOnlyLogEntry>(); var view = new ReadOnlyLogEntryView(entry.Object, Core.Columns.Timestamp); entry.SetupGet(x => x.Timestamp).Returns(new DateTime(2021, 02, 11, 15, 42, 1)); view.Timestamp.Should().Be(new DateTime(2021, 02, 11, 15, 42, 1)); }
public void TestLogLevel_ColumnAvailable() { var entry = new Mock <IReadOnlyLogEntry>(); var view = new ReadOnlyLogEntryView(entry.Object, Core.Columns.LogLevel); entry.SetupGet(x => x.LogLevel).Returns(LevelFlags.Error); view.LogLevel.Should().Be(LevelFlags.Error); }
public void TestOriginalLineNumber_ColumnAvailable() { var entry = new Mock <IReadOnlyLogEntry>(); var view = new ReadOnlyLogEntryView(entry.Object, Core.Columns.OriginalLineNumber); entry.SetupGet(x => x.OriginalLineNumber).Returns(101); view.OriginalLineNumber.Should().Be(101); }
public void TestConstruction() { var entry = new Mock <IReadOnlyLogEntry>(); var view = new ReadOnlyLogEntryView(entry.Object, Core.Columns.RawContent, Core.Columns.Index); view.Columns.Should().Equal(new object[] { Core.Columns.RawContent, Core.Columns.Index }); entry.VerifyGet(x => x.Columns, Times.Never); }
public void TestGetSetValueTyped_NoSuchColumn() { var column = new Mock <IColumnDescriptor <long> >().Object; var anotherColumn = new Mock <IColumnDescriptor <long> >().Object; var entry = new Mock <IReadOnlyLogEntry>(); var view = new ReadOnlyLogEntryView(entry.Object, column); new Action(() => view.GetValue(anotherColumn)).Should().Throw <NoSuchColumnException>(); entry.Verify(x => x.GetValue <long>(It.IsAny <IColumnDescriptor <long> >()), Times.Never); }
public void TestGetSetValueTyped_ColumnAvailable() { var column = new Mock <IColumnDescriptor <long> >().Object; var entry = new Mock <IReadOnlyLogEntry>(); var view = new ReadOnlyLogEntryView(entry.Object, column); entry.Setup(x => x.GetValue(column)).Returns(342L); view.GetValue(column).Should().Be(342L); entry.Verify(x => x.GetValue <long>(column), Times.Once); }
public void TestOriginalIndex_NoSuchColumn() { var entry = new Mock <IReadOnlyLogEntry>(); var view = new ReadOnlyLogEntryView(entry.Object, Core.Columns.Message); new Action(() => { var unused = view.OriginalIndex; }).Should().Throw <NoSuchColumnException>(); entry.VerifyGet(x => x.OriginalIndex, Times.Never); }
public void TestTryGetValueTyped_NoSuchColumn() { var column = new Mock <IColumnDescriptor <string> >().Object; var otherColumn = new Mock <IColumnDescriptor <string> >(); otherColumn.SetupGet(x => x.DefaultValue).Returns("<No Value>"); var entry = new Mock <IReadOnlyLogEntry>(); var view = new ReadOnlyLogEntryView(entry.Object, column); view.TryGetValue(otherColumn.Object, out var actualValue).Should().BeFalse(); actualValue.Should().Be(otherColumn.Object.DefaultValue); }
public void TestTryGetValueTyped_ColumnAvailable() { var column = new Mock <IColumnDescriptor <string> >().Object; var entry = new Mock <IReadOnlyLogEntry>(); var view = new ReadOnlyLogEntryView(entry.Object, column); var expectedValue = "Hello"; entry.Setup(x => x.TryGetValue(column, out expectedValue)).Returns(true); view.TryGetValue(column, out var actualValue).Should().BeTrue(); actualValue.Should().Be(expectedValue); }