예제 #1
0
        public async void ExecutePubmedQueryAndSaveRecords_Should()
        {
            //Arrange
            var mockWebClient   = new Mock <IPubmedWebClient>();
            var mockFileService = new Mock <IFileService>();
            var mockUnitOfWork  = new Mock <ILsUnitOfWork>();

            mockWebClient
            .Setup(x => x.SubmitSearch("mice"))
            .Returns(Task.FromResult(new PubmedResultQueryDto {
                WebEnv = "env", QueryKey = "query", Count = 700
            }));

            var sut = new PubmedService(mockWebClient.Object, mockFileService.Object, mockUnitOfWork.Object);
            //Act
            var result = sut.FindNewPubmedStudiesAndSave(Guid.Empty, Guid.Empty, "desctiption", Guid.Empty, "mice", 500);

            //Assert
            Assert.IsAssignableFrom <IAsyncEnumerable <PubmedXmlFileInfoDto> >(result);
        }