public void AcceptApplicationInfo_WhenNotRequested_ApplicationInfoIsNotSet() { var negotiation = new DicomExtendedNegotiation(DicomUID.Verification, (DicomServiceApplicationInfo)null); negotiation.AcceptApplicationInfo(new DicomCFindApplicationInfo(DicomCFindOption.DateTimeMatching | DicomCFindOption.FuzzySemanticMatching)); Assert.Null(negotiation.RequestedApplicationInfo); Assert.Null(negotiation.AcceptedApplicationInfo); }
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_WhenApplicationInfoIsSet_OrderOfBytesIsAsExpected(DicomServiceApplicationInfo appInfo, byte[] expectedByteOrder) { var sopClass = DicomUID.PatientRootQueryRetrieveInformationModelFind; var negotiation = new DicomExtendedNegotiation(sopClass, appInfo); Assert.Equal(expectedByteOrder, negotiation.RequestedApplicationInfo.GetValues()); foreach (var neg in negotiation.RequestedApplicationInfo) { Assert.Equal(expectedByteOrder[neg.Key - 1], neg.Value); } }
public void AcceptApplicationInfo_WhenRequested_ApplicationInfoIsSetAsExpected(byte[] requested, byte[] accepted, byte[] expected) { var requestedApplicationInfo = new DicomServiceApplicationInfo(requested); var acceptedApplicationInfo = new DicomServiceApplicationInfo(accepted); var expectedApplicationInfo = new DicomServiceApplicationInfo(expected); var negotiation = new DicomExtendedNegotiation(DicomUID.Verification, requestedApplicationInfo); negotiation.AcceptApplicationInfo(acceptedApplicationInfo); Assert.Equal(requestedApplicationInfo, negotiation.RequestedApplicationInfo); Assert.Equal(expectedApplicationInfo, negotiation.AcceptedApplicationInfo); }
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; }