コード例 #1
0
        public void TestGetValues3()
        {
            var properties = Create(new KeyValuePair <ILogFilePropertyDescriptor, object>(LogFileProperties.Created, new DateTime(2017, 12, 29, 13, 1, 0)),
                                    new KeyValuePair <ILogFilePropertyDescriptor, object>(LogFileProperties.StartTimestamp, new DateTime(2017, 12, 29, 13, 3, 0)));

            var buffer = new LogFilePropertyList(LogFileProperties.StartTimestamp);

            properties.GetValues(buffer);
            buffer.GetValue(LogFileProperties.StartTimestamp).Should().Be(new DateTime(2017, 12, 29, 13, 3, 0));
        }
コード例 #2
0
        public void TestSetValue6()
        {
            var properties = new LogFilePropertyList();

            properties.SetValue((ILogFilePropertyDescriptor)LogFileProperties.EmptyReason, ErrorFlags.SourceDoesNotExist);
            properties.GetValue(LogFileProperties.EmptyReason).Should().Be(ErrorFlags.SourceDoesNotExist);

            properties.SetValue((ILogFilePropertyDescriptor)LogFileProperties.EmptyReason, ErrorFlags.SourceCannotBeAccessed);
            properties.GetValue(LogFileProperties.EmptyReason).Should().Be(ErrorFlags.SourceCannotBeAccessed);
        }
コード例 #3
0
        protected override ILogFileProperties Create(params KeyValuePair <ILogFilePropertyDescriptor, object>[] properties)
        {
            var list = new LogFilePropertyList(properties.Select(x => x.Key).ToArray());

            foreach (var pair in properties)
            {
                list.SetValue(pair.Key, pair.Value);
            }

            return(list);
        }
コード例 #4
0
        public void TestConstruction()
        {
            var properties = new LogFilePropertyList(LogFileProperties.Created);

            properties.GetValue(LogFileProperties.Created).Should().Be(LogFileProperties.Created.DefaultValue);
        }