コード例 #1
0
        public void Given_CatalogueId_As_string_1()
        {
            string catalogueId = "1";
            CatalogueByGuidModel catalogueByGuidModel = new CatalogueByGuidModel();
            var taskDecorator = Task.FromResult(catalogueByGuidModel);

            _mockRetrieveCatalogueDetailsRepo.Setup(x => x.GetCatalogueByGuid(It.IsAny <string>())).Returns(taskDecorator);
            var result = _catalogueDetails.GetCatalogueByCatalogueId(catalogueId);

            Assert.IsTrue(result is Task <CatalogueByGuidModel>);
        }
コード例 #2
0
        public async Task <IActionResult> GetCompanyDetails([FromRoute] string catalogueId)
        {
            try
            {
                CatalogueByGuidModel catalogueDetails = await _catalogueDetails.GetCatalogueByCatalogueId(catalogueId);

                if (catalogueDetails != null)
                {
                    return(Ok(catalogueDetails));
                }
                else
                {
                    return(StatusCode(404));
                }
            }
            catch (Exception e)
            {
                return(StatusCode(500, e.Message));
            }
        }