public void Constructor_WithCreatedApplicationInfo_ApplicationInfoTypeIsAsExpected() { var sopClass = DicomUID.PatientRootQueryRetrieveInformationModelFind; var appInfoType = typeof(DicomCFindApplicationInfo); var appInfo = DicomServiceApplicationInfo.Create(sopClass, new byte[] { 1 }); var negotiation = new DicomExtendedNegotiation(sopClass, appInfo); Assert.Equal(sopClass, negotiation.SopClassUid); Assert.Equal(appInfoType, negotiation.RequestedApplicationInfo.GetType()); }
public void Constructor_WithDelegateCreatedApplicationInfo_ApplicationInfoTypeIsAsExpected() { var sopClass = DicomUID.BasicAnnotationBox; var appInfoType = typeof(DicomCFindApplicationInfo); DicomServiceApplicationInfo.OnCreateApplicationInfo = (sop, info) => { if (sop == sopClass) { return(Activator.CreateInstance(appInfoType, info) as DicomServiceApplicationInfo); } return(null); }; var appInfo = DicomServiceApplicationInfo.Create(sopClass, new byte[] { 1 }); var negotiation = new DicomExtendedNegotiation(sopClass, appInfo); Assert.Equal(sopClass, negotiation.SopClassUid); Assert.Equal(appInfoType, negotiation.RequestedApplicationInfo.GetType()); DicomServiceApplicationInfo.OnCreateApplicationInfo = null; }