Exemple #1
0
 private void GivenTheSpecificationContents(string specificationId,
                                            params Entity <Specification, IRelationship>[] contents)
 {
     _specificationRepository
     .GetAllEntities(specificationId)
     .Returns(contents);
 }
 public async Task <IActionResult> GetAllEntities <TNode>(string nodeId)
     where TNode : class
 {
     if (typeof(TNode).IsAssignableFrom(typeof(Specification)))
     {
         return(await ExecuteRepositoryAction(() => _specRepository.GetAllEntities(nodeId), $"Unable to retrieve all entities for {typeof(TNode).Name.ToLowerInvariant()}."));
     }
     else if (typeof(TNode).IsAssignableFrom(typeof(Calculation)))
     {
         return(await ExecuteRepositoryAction(() => _calcRepository.GetAllEntities(nodeId), $"Unable to retrieve all entities for {typeof(TNode).Name.ToLowerInvariant()}."));
     }
     else if (typeof(TNode).IsAssignableFrom(typeof(DataField)))
     {
         return(await ExecuteRepositoryAction(() => _datasetRepository.GetAllEntities(nodeId), $"Unable to retrieve all entities for {typeof(TNode).Name.ToLowerInvariant()}."));
     }
     else if (typeof(TNode).IsAssignableFrom(typeof(FundingLine)))
     {
         return(await ExecuteRepositoryAction(() => _fundingLineRepository.GetAllEntities(nodeId), $"Unable to retrieve all entities for {typeof(TNode).Name.ToLowerInvariant()}."));
     }
     else
     {
         throw new NotImplementedException();
     }
 }