예제 #1
0
        public void GetTaxonomy_Successful()
        {
            //Arrange
            var expectedTaxonomy = new TaxonomySchemeBuilder().GenerateSampleTaxonomy();
            var mockTaxonomy     = new TaxonomySchemeBuilder()
                                   .GenerateSampleMathematicalTaxonomyList()
                                   .Build();

            _taxonomyRepoMock.Setup(mock => mock.GetTaxonomiesByIdentifier(It.IsAny <string>())).Returns(mockTaxonomy);

            // Act
            var taxonomy = _service.GetEntity("https://pid.bayer.com/2fdbd958-b0c3-4a4d-96a9-41641964140d/0");

            // Assert
            TestUtils.AssertSameEntityContent(taxonomy, expectedTaxonomy);
        }
        public IActionResult GetTaxonomyById([FromQuery] string subject)
        {
            var taxonomy = _taxonomyService.GetEntity(subject);

            if (taxonomy == null)
            {
                return(NotFound("No taxonomy for given subject: " + subject));
            }
            ;

            return(Ok(taxonomy));
        }
예제 #3
0
        public IActionResult GetTaxonomyById([FromQuery] string id)
        {
            var taxonomy = _taxonomyService.GetEntity(id);

            if (taxonomy == null)
            {
                return(NotFound("No taxonomy for given Id: " + id));
            }
            ;

            return(Ok(taxonomy));
        }