示例#1
0
        public void HashSetHelperTest_HashSetSingleComma()
        {
            // testing with double commas those are not supported by the c# exif read tool
            var result        = HashSetHelper.StringToHashSet("test,test1");
            var expetedresult = HashSetHelper.HashSetToString(result);

            Assert.AreEqual("test, test1", expetedresult);
        }
示例#2
0
        public void HashSetHelperTest_HashSetDuplicateContent()
        {
            // hashsets does not support duplicates, but test the comma implementation
            var result        = HashSetHelper.StringToHashSet("test, test");
            var expetedresult = HashSetHelper.HashSetToString(result);

            Assert.AreEqual("test", expetedresult);
        }
示例#3
0
        /// <summary>
        /// Read "dc:subject" values from XMP
        /// </summary>
        /// <param name="exifItem">item</param>
        /// <returns></returns>
        private static string GetXmpDataSubject(Directory exifItem)     //
        {
            if (!(exifItem is XmpDirectory xmpDirectory) || xmpDirectory.XmpMeta == null)
            {
                return(string.Empty);
            }

            var tagsList = new HashSet <string>();

            foreach (var property in xmpDirectory.XmpMeta.Properties.Where(p => !string.IsNullOrEmpty(p.Value)))
            {
                if (property.Path.StartsWith("dc:subject["))
                {
                    tagsList.Add(property.Value);
                }
            }
            return(HashSetHelper.HashSetToString(tagsList));
        }
示例#4
0
 public void HashSetHelperTest_SetToStringNull()
 {
     Assert.AreEqual(string.Empty, HashSetHelper.HashSetToString(null));
 }