public void TestGetSupplierByIdReturnsSupplierSuccess() { Models.Response.Supplier fakesupplierResponse = this.GetFakeSupplierResponseModel(); this.MockGetAllSuppliersResponseTables(true); var result = supplierRepositoryMock.GetById(1).Result; Assert.IsNotNull(result.Result); Assert.IsTrue(result.Result.MGSupplier != null); }
public async Task <IActionResult> GetById(string id) { var record = await _SupplierService.GetById(id); if (record == null) { return(NotFound()); } return(Ok(record)); }
public async Task <IActionResult> GetById(int id) { try { BaseResult <Models.Response.Supplier> result = await _iSupplierRepository.GetById(id); if (result.IsError && result.ExceptionMessage != null) { return(new StatusCodeResult(500)); } if (result.Result == null) { return(NoContent()); //204 } return(Ok(result)); } catch (Exception ex) { Dictionary <string, string> inputParameter = new Dictionary <string, string>(); LogHelper.LogError(_iLogger, Constants.AppName, "GetById", "Error Occurred. ", "SupplierController", ex, Constants.InternalErrorStatusCode, null); return(new StatusCodeResult(500)); } }