public void Get_IntWithIntArgumentTagNonExisting_ShouldThrow() { var dataset = new DicomDataset(); var e = Record.Exception(() => dataset.GetValue <int>(DicomTag.MetersetRate, 20)); Assert.IsType <DicomDataException>(e); }
public void Get_Value_TagMissing_ShouldThrow() { var tag = DicomTag.SimpleFrameList; var dataset = new DicomDataset(); var e = Record.Exception(() => dataset.GetValue <long>(tag, 0)); Assert.IsType <DicomDataException>(e); }
public void Add_UnlimitedCharactersElementWithMultipleStrings_Succeeds() { var tag = DicomTag.LongCodeValue; var dataset = new DicomDataset(); dataset.Add(tag, "a", "b", "c"); Assert.IsType <DicomUnlimitedCharacters>(dataset.First(item => item.Tag.Equals(tag))); Assert.Equal("c", dataset.GetValue <string>(tag, 2)); }
public void Get_IntOutsideRange_ShouldThrow() { var tag = DicomTag.SelectorISValue; var dataset = new DicomDataset(); dataset.Add(tag, 3, 4, 5); var e = Record.Exception(() => dataset.GetValue <int>(tag, 10)); Assert.IsType <DicomDataException>(e); }
private static void TestAddElementToDatasetAsByteBuffer <T>(DicomElement element, T[] testValues) { DicomDataset ds = new DicomDataset(); ds.Add(element.Tag, element.Buffer); for (int index = 0; index < testValues.Count(); index++) { Assert.Equal(testValues[index], ds.GetValue <T>(element.Tag, index)); } }
private string GetStringValue(DicomElement element, DicomDataset ds, int index) { string val; if (element.ValueRepresentation == DicomVR.AT) { //Should this be a updated in the AT DicomTag? val = GetATElementValue(element, ds, index); } else { val = ds.GetValue <string>(element.Tag, index); } return(val); }