Example #1
0
 public void Test_TrimEmptyEndingComponentsOption()
 {
     Assert.AreEqual(DicomNameUtils.Normalize("Ab C", DicomNameUtils.NormalizeOptions.TrimEmptyEndingComponents), "Ab C");
     Assert.AreEqual(DicomNameUtils.Normalize("Ab C^", DicomNameUtils.NormalizeOptions.TrimEmptyEndingComponents), "Ab C");
     Assert.AreEqual(DicomNameUtils.Normalize("Ab C^ABC", DicomNameUtils.NormalizeOptions.TrimEmptyEndingComponents), "Ab C^ABC");
     Assert.AreEqual(DicomNameUtils.Normalize("Ab C^ABC^^", DicomNameUtils.NormalizeOptions.TrimEmptyEndingComponents), "Ab C^ABC");
     Assert.AreEqual(DicomNameUtils.Normalize("Ab C^ABC^ ^ ^ ", DicomNameUtils.NormalizeOptions.TrimEmptyEndingComponents), "Ab C^ABC");
 }
Example #2
0
        public void Test_TrimSpacesOption()
        {
            Assert.AreEqual(DicomNameUtils.Normalize("Ab C", DicomNameUtils.NormalizeOptions.TrimSpaces), "Ab C");
            Assert.AreEqual(DicomNameUtils.Normalize("Ab C ", DicomNameUtils.NormalizeOptions.TrimSpaces), "Ab C");
            Assert.AreEqual(DicomNameUtils.Normalize("Ab C  ", DicomNameUtils.NormalizeOptions.TrimSpaces), "Ab C");
            Assert.AreEqual(DicomNameUtils.Normalize(" Ab C  ", DicomNameUtils.NormalizeOptions.TrimSpaces), "Ab C");
            Assert.AreEqual(DicomNameUtils.Normalize("  Ab       C  ", DicomNameUtils.NormalizeOptions.TrimSpaces), "Ab C");


            Assert.AreEqual(DicomNameUtils.Normalize("Ab C^Ab C", DicomNameUtils.NormalizeOptions.TrimSpaces), "Ab C^Ab C");
            Assert.AreEqual(DicomNameUtils.Normalize("Ab C ^Ab C ", DicomNameUtils.NormalizeOptions.TrimSpaces), "Ab C^Ab C");
            Assert.AreEqual(DicomNameUtils.Normalize("Ab C  ^Ab C  ", DicomNameUtils.NormalizeOptions.TrimSpaces), "Ab C^Ab C");
            Assert.AreEqual(DicomNameUtils.Normalize(" Ab C  ^ Ab C  ", DicomNameUtils.NormalizeOptions.TrimSpaces), "Ab C^Ab C");
            Assert.AreEqual(DicomNameUtils.Normalize("  Ab C  ^  Ab C  ", DicomNameUtils.NormalizeOptions.TrimSpaces), "Ab C^Ab C");
            Assert.AreEqual(DicomNameUtils.Normalize("  Ab       C  ^  Ab  C  ", DicomNameUtils.NormalizeOptions.TrimSpaces), "Ab C^Ab C");

            Assert.AreEqual(DicomNameUtils.Normalize("Ab C^Ab C ^ ^ ^ ", DicomNameUtils.NormalizeOptions.TrimSpaces), "Ab C^Ab C^^^");
            Assert.AreEqual(DicomNameUtils.Normalize("Ab   C^Ab   C ^ ^ ^ ", DicomNameUtils.NormalizeOptions.TrimSpaces), "Ab C^Ab C^^^");
        }
Example #3
0
 /// <summary>
 /// Returns an acceptable name for the given name.
 /// </summary>
 /// <param name="originalName"></param>
 /// <returns></returns>
 static public string GetAcceptableName(string originalName)
 {
     return(DicomNameUtils.Normalize(originalName, DicomNameUtils.NormalizeOptions.TrimSpaces | DicomNameUtils.NormalizeOptions.TrimEmptyEndingComponents));
 }
Example #4
0
 public void Test_CombinedOptions()
 {
     Assert.AreEqual(DicomNameUtils.Normalize("   Ab    C           ^    ABC     ^         ^     ^     ", DicomNameUtils.NormalizeOptions.TrimEmptyEndingComponents | DicomNameUtils.NormalizeOptions.TrimSpaces), "Ab C^ABC");
 }