Exemple #1
0
        public void ShouldIgnoreNonThirdPartyAttributeDataEntries(ProtoBuf.Share.DataEntry.Types.Type dataEntryType)
        {
            var dataEntry = new DataEntry
            {
                Type  = dataEntryType,
                Value = ByteString.CopyFromUtf8("value")
            };

            Assert.IsNull(DataEntryConverter.ConvertDataEntry(dataEntry));
        }
        private static object ConvertValue(ProtoBuf.Share.DataEntry.Types.Type dataEntryType, ByteString value)
        {
            NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();

            switch (dataEntryType)
            {
            case ProtoBuf.Share.DataEntry.Types.Type.ThirdPartyAttribute:
                return(ThirdPartyAttributeConverter.ParseThirdPartyAttribute(value.ToByteArray()));

            default:
                logger.Warn($"Unsupported data entry '{dataEntryType.ToString()}', skipping...");
                return(null);
            }
        }