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"); }
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^^^"); }
/// <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)); }
public void Test_CombinedOptions() { Assert.AreEqual(DicomNameUtils.Normalize(" Ab C ^ ABC ^ ^ ^ ", DicomNameUtils.NormalizeOptions.TrimEmptyEndingComponents | DicomNameUtils.NormalizeOptions.TrimSpaces), "Ab C^ABC"); }