public void GetDicomQuery_ReturnsDicomQuery()
        {
            // Arrange
            var mockProvider = new MockProvider();
            var dicomQueryProvider = new DicomQueryProvider<TestInfo>(mockProvider.GetGeneralizedInfoProviderFake(), mockProvider.GetDicomDataLoaderFake());

            // Act + Assert
            Assert.That(() => dicomQueryProvider.GetDicomQuery(), Throws.Nothing);
        }
Exemplo n.º 2
0
        public async void LoadFromCache_ToListAsync_LoadsFromCache()
        {
            // Arrange
            var mockProvider = new MockProvider();
            var dicomDataLoader = mockProvider.GetDicomDataLoaderFake();
            var dicomQuery = new DicomQuery<TestInfo>(mockProvider.GetGeneralizedInfoProviderFake(), dicomDataLoader, mockProvider.GetWhereCollectionFake());

            // Act
            await dicomQuery.LoadFromServer().LoadFromCache().ToListAsync();

            // Assert
            Assert.That(() => dicomDataLoader.Received(1).LoadDataFromCacheAsync(Arg.Any<IWhereCollection<TestInfo>>()), Throws.Nothing);
        }
        public void WhereLike_WithoutCache_AddsConditionToRequest()
        {
            // Arrange
            var requestFactory = new DicomRequestFactoryFake();
            var mockProvider = new MockProvider();
            IDicomQuery<TestInfo> dicomQuery = new DicomQuery<TestInfo>(mockProvider.GetGeneralizedInfoProviderFake(), mockProvider.GetDicomDataLoaderFake(), mockProvider.GetWhereCollectionFake());

            // Act
            dicomQuery = dicomQuery.WhereLike(DicomTags.PatientID, 1);
            dicomQuery.ToList();
            var whereItem = ((IWhereCollection<TestInfo>)requestFactory.WhereCollection).Single();

            // Assert
            Assert.That(whereItem.DicomTag, Is.EqualTo(DicomTags.PatientID));
            Assert.That(whereItem.Value, Is.EqualTo(1));
            Assert.That(whereItem.Operator, Is.EqualTo(WhereOperator.Like));
        }
        public void WhereLike_WithCache_FilterInMemoryList()
        {
            // Arrange
            var mockProvider = new MockProvider();
            IDicomQuery<TestInfo> dicomQuery = new DicomQuery<TestInfo>(mockProvider.GetGeneralizedInfoProviderFake(), mockProvider.GetDicomDataLoaderFake(), mockProvider.GetWhereCollectionFake());

            // Act
            dicomQuery = dicomQuery.WhereLike(DicomTags.PatientID, 1);
            var result = dicomQuery.ToList().Select(info => info.PatientID).ToList();

            // Assert
            Assert.That(result.Count, Is.EqualTo(2));
            Assert.That(result.Contains(1), Is.True);
            Assert.That(result.Contains(10), Is.True);
        }
        public void WhereEquals_WithCache_FilterInMemoryList()
        {
            // Arrange
            var mockProvider = new MockProvider();
            IDicomQuery<TestInfo> dicomQuery = new DicomQuery<TestInfo>(mockProvider.GetGeneralizedInfoProviderFake(), mockProvider.GetDicomDataLoaderFake(), mockProvider.GetWhereCollectionFake());

            // Act
            dicomQuery = dicomQuery.WhereEquals(DicomTags.PatientID, 1);
            var result = dicomQuery.ToList().Single();

            // Assert
            Assert.That(result.PatientID, Is.EqualTo(1));
        }