コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }