コード例 #1
0
        public async void Get_Success()
        {
            var service = new FhirSearch(_nrlsApiSettings, _nrlsMongoDBCaller, _fhirSearchHelper);

            var resource = await service.Get <DocumentReference>(FhirRequests.Valid_Read);

            Assert.NotNull(resource);
            Assert.IsType <DocumentReference>(resource);
        }
コード例 #2
0
        public async void Find_Success_Bundle_Single()
        {
            var service = new FhirSearch(_nrlsApiSettings, _nrlsMongoDBCaller, _fhirSearchHelper);

            var resource = await service.Find <DocumentReference>(FhirRequests.Valid_Create, true);

            Assert.IsType <Bundle>(resource);

            Assert.Equal(1, resource.Total);
            Assert.Single(resource.Entry);
        }
コード例 #3
0
        public async void Find_Success_Bundle()
        {
            //var testBson = new BsonDocument(new BsonElement("_id", new ObjectId("5b7bcc664af1d03816095dac")));

            //var collectionMock = new Mock<IMongoCollection<BsonDocument>>();
            //collectionMock.Setup(m => m.InsertOneAsync(It.IsAny<BsonDocument>(), null, default(System.Threading.CancellationToken))).Returns(SystemTasks.Task.Run(() => testBson));

            //var dbMock = new Mock<INRLSMongoDBContext>();
            //dbMock.Setup(op => op.Resource(It.IsAny<string>())).Returns(collectionMock.Object);

            var service = new FhirSearch(_nrlsApiSettings, _nrlsMongoDBCaller, _fhirSearchHelper);

            var resource = await service.Find <DocumentReference>(FhirRequests.Valid_Create, false);

            Assert.IsType <Bundle>(resource);

            Assert.Equal(2, resource.Total);
            Assert.Equal(2, resource.Entry.Count);
        }