コード例 #1
0
        public void GetStudiesForPatient_NullPatient_ThrowsException()
        {
            // Arrange
            MockProvider mockProvider = new MockProvider();
            StudyInfoProvider studyInfoProvider = new StudyInfoProvider(mockProvider.GetDicomQueryProviderForStudiesFake(), mockProvider.GetDicomDownloaderForStudiesFake());

            // Act + Assert
            Assert.That(() => studyInfoProvider.GetStudiesForPatient(null), Throws.InstanceOf<ArgumentNullException>());
        }
コード例 #2
0
        public void GetStudiesForPatient_ProperQueryIsCreated([Values("910725/6444", "9107256444")] string birthNumber)
        {
            // Arrange
            MockProvider mockProvider = new MockProvider();
            var queryProvider = Substitute.For<IDicomQueryProvider<StudyInfo>>();
            var dataLoader = Substitute.For<IDicomDataLoader<StudyInfo>>();
            var whereCollection = Substitute.For<IWhereCollection<StudyInfo>>();
            var query = Substitute.For<DicomQuery<StudyInfo>>(mockProvider.GetGeneralizedInfoProviderFake(), dataLoader, whereCollection);
            queryProvider.GetDicomQuery().Returns(query);

            PatientInfo patient = new PatientInfo
            {
                PatientID = new BirthNumber(birthNumber)
            };

            StudyInfoProvider studyInfoProvider = new StudyInfoProvider(queryProvider, mockProvider.GetDicomDownloaderForStudiesFake());

            // Act
            studyInfoProvider.GetStudiesForPatient(patient);

            // Assert
            Assert.That(() => whereCollection.Received(1).WhereEquals(DicomTags.PatientID, birthNumber), Throws.Nothing);
        }