public void TestPersonNameArrayConverter() { string input = null; PersonName[] output = DicomStringHelper.GetPersonNameArray(input); Assert.AreEqual(output.Length, 0); input = ""; output = DicomStringHelper.GetPersonNameArray(input); Assert.AreEqual(output.Length, 0); input = @"Doe^John^^^\Doe^Jane^^^"; output = DicomStringHelper.GetPersonNameArray(input); Assert.AreEqual(output[0].FirstName, "John"); Assert.AreEqual(output[0].LastName, "Doe"); Assert.AreEqual(output[1].FirstName, "Jane"); Assert.AreEqual(output[1].LastName, "Doe"); }
public void TestListFormatters() { string input = @"The\brown\dog\\jumped"; string result = DicomDataFormatHelper.StringListFormat(DicomStringHelper.GetStringArray(input)); Assert.AreEqual(result, "The,\nbrown,\ndog,\njumped"); input = @"Doe^John^^^"; result = DicomDataFormatHelper.PersonNameFormatter(new PersonName(input)); Assert.AreEqual(result, "Doe, John"); input = @"^John^^^"; result = DicomDataFormatHelper.PersonNameFormatter(new PersonName(input)); Assert.AreEqual(result, "John"); input = @"Doe^^^^"; result = DicomDataFormatHelper.PersonNameFormatter(new PersonName(input)); Assert.AreEqual(result, "Doe"); input = @"Doe^John^^^\Doe^Jane^^^"; result = DicomDataFormatHelper.PersonNameListFormatter(DicomStringHelper.GetPersonNameArray(input)); Assert.AreEqual(result, "Doe, John,\nDoe, Jane"); input = @"^John^^^\Doe^Jane^^^"; result = DicomDataFormatHelper.PersonNameListFormatter(DicomStringHelper.GetPersonNameArray(input)); Assert.AreEqual(result, "John,\nDoe, Jane"); input = @"^John^^^\Doe^^^^"; result = DicomDataFormatHelper.PersonNameListFormatter(DicomStringHelper.GetPersonNameArray(input)); Assert.AreEqual(result, "John,\nDoe"); input = @"^^^^\Doe^^^^"; result = DicomDataFormatHelper.PersonNameListFormatter(DicomStringHelper.GetPersonNameArray(input)); Assert.AreEqual(result, "Doe"); input = @"^^^^\^^^^"; result = DicomDataFormatHelper.PersonNameListFormatter(DicomStringHelper.GetPersonNameArray(input)); Assert.AreEqual(result, ""); }