public void TestModalitiesInStudyPostFiltering()
		{
			MockRemoteStudyFinder finder = new MockRemoteStudyFinder();
			Dictionary<string, DicomAttributeCollection> results = new Dictionary<string, DicomAttributeCollection>();
			List<DicomAttributeCollection> serverResults = new List<DicomAttributeCollection>();
			
			string modalityFilter = "";

			serverResults.Add(GetModalityResult("MR", "1"));
			serverResults.Add(GetModalityResult("PT\\CT", "2"));
			serverResults.Add(GetModalityResult("MR\\CT", "3"));

			//empty filter, everything is a match
			Assert.IsTrue(finder.TestFilterResults(serverResults, results, modalityFilter));
			Assert.AreEqual(results.Count, 3);

			//filter on MR, a PT/CT study exists in the results, so everything is a match
			results.Clear();
			modalityFilter = "MR";
			Assert.IsTrue(finder.TestFilterResults(serverResults, results, modalityFilter));
			Assert.AreEqual(results.Count, 2);

			//filter on MR\\CT, each result set contains good matches, so we keep performing queries.
			modalityFilter = "MR";
			results.Clear();
			serverResults.Clear();
			serverResults.Add(GetModalityResult("MR", "1"));
			serverResults.Add(GetModalityResult("MR\\CT", "2"));
			serverResults.Add(GetModalityResult("MR\\CT\\OT", "3"));
			Assert.IsFalse(finder.TestFilterResults(serverResults, results, modalityFilter));
			Assert.AreEqual(results.Count, 3);

			modalityFilter = "CT";
			serverResults.Clear();
			serverResults.Add(GetModalityResult("MR\\CT", "2"));
			serverResults.Add(GetModalityResult("MR\\CT\\OT", "3"));
			serverResults.Add(GetModalityResult("CT", "4"));
			serverResults.Add(GetModalityResult("MR\\CT", "5"));
			serverResults.Add(GetModalityResult("MR\\CT\\SC", "6"));
			Assert.IsFalse(finder.TestFilterResults(serverResults, results, modalityFilter));
			Assert.AreEqual(results.Count, 6);

			//when a server does not even return ModalitiesInStudy, it means it is not supported at all.
			modalityFilter = "MR";
			results.Clear();
			serverResults.Clear();
			serverResults.Add(GetModalityResult(null, "1"));
			serverResults.Add(GetModalityResult(null, "2"));
			serverResults.Add(GetModalityResult(null, "3"));
			Assert.IsTrue(finder.TestFilterResults(serverResults, results, modalityFilter));
			Assert.AreEqual(results.Count, 3);

			//We don't support this right now anyway, but if a wildcard query were done, we would just include all the results.
			modalityFilter = "M*";
			results.Clear();
			serverResults.Clear();
			serverResults.Add(GetModalityResult("MR", "1"));
			serverResults.Add(GetModalityResult("MR\\CT", "2"));
			serverResults.Add(GetModalityResult("MR\\CT\\OT", "3"));
			Assert.IsFalse(finder.TestFilterResults(serverResults, results, modalityFilter));
			Assert.AreEqual(results.Count, 3);
			
		}
Esempio n. 2
0
        public void TestModalitiesInStudyPostFiltering()
        {
            MockRemoteStudyFinder finder = new MockRemoteStudyFinder();
            Dictionary <string, DicomAttributeCollection> results = new Dictionary <string, DicomAttributeCollection>();
            List <DicomAttributeCollection> serverResults         = new List <DicomAttributeCollection>();

            string modalityFilter = "";

            serverResults.Add(GetModalityResult("MR", "1"));
            serverResults.Add(GetModalityResult("PT\\CT", "2"));
            serverResults.Add(GetModalityResult("MR\\CT", "3"));

            //empty filter, everything is a match
            Assert.IsTrue(finder.TestFilterResults(serverResults, results, modalityFilter));
            Assert.AreEqual(results.Count, 3);

            //filter on MR, a PT/CT study exists in the results, so everything is a match
            results.Clear();
            modalityFilter = "MR";
            Assert.IsTrue(finder.TestFilterResults(serverResults, results, modalityFilter));
            Assert.AreEqual(results.Count, 2);

            //filter on MR\\CT, each result set contains good matches, so we keep performing queries.
            modalityFilter = "MR";
            results.Clear();
            serverResults.Clear();
            serverResults.Add(GetModalityResult("MR", "1"));
            serverResults.Add(GetModalityResult("MR\\CT", "2"));
            serverResults.Add(GetModalityResult("MR\\CT\\OT", "3"));
            Assert.IsFalse(finder.TestFilterResults(serverResults, results, modalityFilter));
            Assert.AreEqual(results.Count, 3);

            modalityFilter = "CT";
            serverResults.Clear();
            serverResults.Add(GetModalityResult("MR\\CT", "2"));
            serverResults.Add(GetModalityResult("MR\\CT\\OT", "3"));
            serverResults.Add(GetModalityResult("CT", "4"));
            serverResults.Add(GetModalityResult("MR\\CT", "5"));
            serverResults.Add(GetModalityResult("MR\\CT\\SC", "6"));
            Assert.IsFalse(finder.TestFilterResults(serverResults, results, modalityFilter));
            Assert.AreEqual(results.Count, 6);

            //when a server does not even return ModalitiesInStudy, it means it is not supported at all.
            modalityFilter = "MR";
            results.Clear();
            serverResults.Clear();
            serverResults.Add(GetModalityResult(null, "1"));
            serverResults.Add(GetModalityResult(null, "2"));
            serverResults.Add(GetModalityResult(null, "3"));
            Assert.IsTrue(finder.TestFilterResults(serverResults, results, modalityFilter));
            Assert.AreEqual(results.Count, 3);

            //We don't support this right now anyway, but if a wildcard query were done, we would just include all the results.
            modalityFilter = "M*";
            results.Clear();
            serverResults.Clear();
            serverResults.Add(GetModalityResult("MR", "1"));
            serverResults.Add(GetModalityResult("MR\\CT", "2"));
            serverResults.Add(GetModalityResult("MR\\CT\\OT", "3"));
            Assert.IsFalse(finder.TestFilterResults(serverResults, results, modalityFilter));
            Assert.AreEqual(results.Count, 3);
        }