public void test_CompartmentType() { CompartmentType ct = new CompartmentType(2, 4); assertEquals(true, ct.hasRequiredElements()); ct = null; }
private static IReadOnlyCollection <string> GetResourceIdsForCompartmentType(CompartmentType compartmentType, CompartmentIndices compartmentIndices) { IReadOnlyCollection <string> resourceIds = null; if (compartmentType == CompartmentType.Device) { resourceIds = compartmentIndices.DeviceCompartmentEntry; } else if (compartmentType == CompartmentType.Encounter) { resourceIds = compartmentIndices.EncounterCompartmentEntry; } else if (compartmentType == CompartmentType.Patient) { resourceIds = compartmentIndices.PatientCompartmentEntry; } else if (compartmentType == CompartmentType.Practitioner) { resourceIds = compartmentIndices.PractitionerCompartmentEntry; } else if (compartmentType == CompartmentType.RelatedPerson) { resourceIds = compartmentIndices.RelatedPersonCompartmentEntry; } return(resourceIds); }
/// <summary> /// Initializes a new instance of the <see cref="CompartmentSearchExpression"/> class. /// </summary> /// <param name="compartmentType">The compartment type.</param> /// <param name="compartmentId">The compartment id.</param> public CompartmentSearchExpression(CompartmentType compartmentType, string compartmentId) { EnsureArg.IsTrue(Enum.IsDefined(typeof(CompartmentType), compartmentType), nameof(compartmentType)); EnsureArg.IsNotNullOrWhiteSpace(compartmentId, nameof(compartmentId)); CompartmentType = compartmentType; CompartmentId = compartmentId; }
public static CompartmentTypeDTO ToDTO(this CompartmentType ObjectToConvert) { return(new CompartmentTypeDTO() { ID = ObjectToConvert.ID, Description = ObjectToConvert.Description }); }
public void test_Model_createCompartmentType() { CompartmentType c = M.createCompartmentType(); assertTrue(c != null); assertTrue(M.getNumCompartmentTypes() == 1); assertEquals(M.getCompartmentType(0), c); }
public void test_CompartmentType() { CompartmentType ct = new CompartmentType(2, 4); assertEquals(false, (ct.hasRequiredAttributes())); ct.setId("c"); assertEquals(true, ct.hasRequiredAttributes()); ct = null; }
public void setUp() { CT = new CompartmentType(2, 4); if (CT == null) { ; } { } }
public void setUp() { C = new CompartmentType(2, 2); if (C == null) { ; } { } }
public static void ValidateCompartmentSearchExpression( Expression expression, CompartmentType compartmentType, string compartmentId) { CompartmentSearchExpression compartmentSearchExpression = Assert.IsType <CompartmentSearchExpression>(expression); Assert.Equal(compartmentType, compartmentSearchExpression.CompartmentType); Assert.Equal(compartmentId, compartmentSearchExpression.CompartmentId); }
public void test_CompartmentType_parent_create() { Model m = new Model(2, 4); CompartmentType ct = m.createCompartmentType(); ListOf lo = m.getListOfCompartmentTypes(); assertTrue(lo == m.getCompartmentType(0).getParentSBMLObject()); assertTrue(lo == ct.getParentSBMLObject()); assertTrue(m == lo.getParentSBMLObject()); }
public void test_Model_addCompartmentType3() { Model m = new Model(2, 2); CompartmentType ct = null; int i = m.addCompartmentType(ct); assertTrue(i == libsbml.LIBSBML_OPERATION_FAILED); assertTrue(m.getNumCompartmentTypes() == 0); m = null; }
public void test_Model_createCompartmentType() { Model m = new Model(2, 2); CompartmentType p = m.createCompartmentType(); assertTrue(m.getNumCompartmentTypes() == 1); assertTrue((p).getLevel() == 2); assertTrue((p).getVersion() == 2); m = null; }
public PropertyPackage(string name, int area, CompartmentType type, ProfileType profile, int connectivity, float lootLevel, int securityLevel) { Name = name; Area = area; Type = type; Profile = profile; Connectivity = connectivity; LootLevel = lootLevel; SecurityLevel = securityLevel; }
public bool TryGetSearchParams(ResourceType resourceType, CompartmentType compartment, out HashSet <string> searchParams) { if (_compartmentSearchParamsLookup.TryGetValue(resourceType, out Dictionary <CompartmentType, HashSet <string> > compartmentSearchParams) && compartmentSearchParams.TryGetValue(compartment, out searchParams)) { return(true); } searchParams = null; return(false); }
public void test_CompartmentType_copyConstructor() { CompartmentType o1 = new CompartmentType(2, 4); o1.setId("c"); assertTrue(o1.getId() == "c"); CompartmentType o2 = new CompartmentType(o1); assertTrue(o2.getId() == "c"); assertTrue(o2.getParentSBMLObject() == o1.getParentSBMLObject()); o2 = null; o1 = null; }
public void test_CompartmentType_parent_add() { CompartmentType ct = new CompartmentType(2, 4); Model m = new Model(2, 4); ct.setId("ct"); m.addCompartmentType(ct); ct = null; ListOf lo = m.getListOfCompartmentTypes(); assertTrue(lo == m.getCompartmentType(0).getParentSBMLObject()); assertTrue(m == lo.getParentSBMLObject()); }
public void test_Model_addCompartmentType2() { Model m = new Model(2, 2); CompartmentType ct = new CompartmentType(2, 3); ct.setId("ct"); int i = m.addCompartmentType(ct); assertTrue(i == libsbml.LIBSBML_VERSION_MISMATCH); assertTrue(m.getNumCompartmentTypes() == 0); ct = null; m = null; }
public void test_CompartmentType_parent_NULL() { SBMLDocument d = new SBMLDocument(2, 4); Model m = d.createModel(); CompartmentType c = m.createCompartmentType(); CompartmentType c1 = c.clone(); d = null; assertTrue(c1.getAncestorOfType(libsbml.SBML_MODEL) == null); assertTrue(c1.getParentSBMLObject() == null); assertEquals(c1.getSBMLDocument(), null); c1 = null; }
public void test_Model_addCompartmentType1() { Model m = new Model(2, 2); CompartmentType ct = new CompartmentType(2, 2); int i = m.addCompartmentType(ct); assertTrue(i == libsbml.LIBSBML_INVALID_OBJECT); ct.setId("ct"); i = m.addCompartmentType(ct); assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS); assertTrue(m.getNumCompartmentTypes() == 1); ct = null; m = null; }
public void test_CompartmentType_assignmentOperator() { CompartmentType o1 = new CompartmentType(2, 4); o1.setId("c"); assertTrue(o1.getId() == "c"); CompartmentType o2 = new CompartmentType(2, 4); o2 = o1; assertTrue(o2.getId() == "c"); assertTrue(o2.getParentSBMLObject() == o1.getParentSBMLObject()); o2 = null; o1 = null; }
public void test_CompartmentType_ancestor_add() { CompartmentType ct = new CompartmentType(2, 4); Model m = new Model(2, 4); ct.setId("ct"); m.addCompartmentType(ct); ct = null; ListOf lo = m.getListOfCompartmentTypes(); CompartmentType obj = m.getCompartmentType(0); assertTrue(obj.getAncestorOfType(libsbml.SBML_MODEL) == m); assertTrue(obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo); assertTrue(obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null); assertTrue(obj.getAncestorOfType(libsbml.SBML_EVENT) == null); }
public void test_CompartmentType_ancestor_create() { Model m = new Model(2, 4); CompartmentType ct = m.createCompartmentType(); ListOf lo = m.getListOfCompartmentTypes(); assertTrue(ct.getAncestorOfType(libsbml.SBML_MODEL) == m); assertTrue(ct.getAncestorOfType(libsbml.SBML_LIST_OF) == lo); assertTrue(ct.getAncestorOfType(libsbml.SBML_DOCUMENT) == null); assertTrue(ct.getAncestorOfType(libsbml.SBML_EVENT) == null); CompartmentType obj = m.getCompartmentType(0); assertTrue(obj.getAncestorOfType(libsbml.SBML_MODEL) == m); assertTrue(obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo); assertTrue(obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null); assertTrue(obj.getAncestorOfType(libsbml.SBML_EVENT) == null); }
public void test_CompartmentType_createWithNS() { XMLNamespaces xmlns = new XMLNamespaces(); xmlns.add("http://www.sbml.org", "testsbml"); SBMLNamespaces sbmlns = new SBMLNamespaces(2, 2); sbmlns.addNamespaces(xmlns); CompartmentType object1 = new CompartmentType(sbmlns); assertTrue(object1.getTypeCode() == libsbml.SBML_COMPARTMENT_TYPE); assertTrue(object1.getMetaId() == ""); assertTrue(object1.getNotes() == null); assertTrue(object1.getAnnotation() == null); assertTrue(object1.getLevel() == 2); assertTrue(object1.getVersion() == 2); assertTrue(object1.getNamespaces() != null); assertTrue(object1.getNamespaces().getLength() == 2); object1 = null; }
private static ResourceType GetResourceTypeForCompartmentCode(CompartmentType Code) { switch (Code) { case CompartmentType.Patient: return(ResourceType.Patient); case CompartmentType.Encounter: return(ResourceType.Encounter); case CompartmentType.RelatedPerson: return(ResourceType.RelatedPerson); case CompartmentType.Practitioner: return(ResourceType.Practitioner); case CompartmentType.Device: return(ResourceType.Device); default: throw new Exception("No Resource Type for CompartmentType"); } }
static void testClone(SBase s) { string ename = s.getElementName(); SBase c = s.clone(); if (c is Compartment) { Compartment x = (s as Compartment).clone(); c = x; } else if (c is CompartmentType) { CompartmentType x = (s as CompartmentType).clone(); c = x; } else if (c is Constraint) { Constraint x = (s as Constraint).clone(); c = x; } else if (c is Delay) { Delay x = (s as Delay).clone(); c = x; } else if (c is Event) { Event x = (s as Event).clone(); c = x; } else if (c is EventAssignment) { EventAssignment x = (s as EventAssignment).clone(); c = x; } else if (c is FunctionDefinition) { FunctionDefinition x = (s as FunctionDefinition).clone(); c = x; } else if (c is InitialAssignment) { InitialAssignment x = (s as InitialAssignment).clone(); c = x; } else if (c is KineticLaw) { KineticLaw x = (s as KineticLaw).clone(); c = x; } // currently return type of ListOf::clone() is SBase else if (c is ListOf) { SBase x = (s as ListOf).clone(); c = x; } else if (c is Model) { Model x = (s as Model).clone(); c = x; } else if (c is Parameter) { Parameter x = (s as Parameter).clone(); c = x; } else if (c is Reaction) { Reaction x = (s as Reaction).clone(); c = x; } else if (c is AlgebraicRule) { AlgebraicRule x = (s as AlgebraicRule).clone(); c = x; } else if (c is AssignmentRule) { AssignmentRule x = (s as AssignmentRule).clone(); c = x; } else if (c is RateRule) { RateRule x = (s as RateRule).clone(); c = x; } else if (c is SBMLDocument) { SBMLDocument x = (s as SBMLDocument).clone(); c = x; } else if (c is Species) { Species x = (s as Species).clone(); c = x; } else if (c is SpeciesReference) { SpeciesReference x = (s as SpeciesReference).clone(); c = x; } else if (c is SpeciesType) { SpeciesType x = (s as SpeciesType).clone(); c = x; } else if (c is SpeciesReference) { SpeciesReference x = (s as SpeciesReference).clone(); c = x; } else if (c is StoichiometryMath) { StoichiometryMath x = (s as StoichiometryMath).clone(); c = x; } else if (c is Trigger) { Trigger x = (s as Trigger).clone(); c = x; } else if (c is Unit) { Unit x = (s as Unit).clone(); c = x; } else if (c is UnitDefinition) { UnitDefinition x = (s as UnitDefinition).clone(); c = x; } else if (c is ListOfCompartmentTypes) { ListOfCompartmentTypes x = (s as ListOfCompartmentTypes).clone(); c = x; } else if (c is ListOfCompartments) { ListOfCompartments x = (s as ListOfCompartments).clone(); c = x; } else if (c is ListOfConstraints) { ListOfConstraints x = (s as ListOfConstraints).clone(); c = x; } else if (c is ListOfEventAssignments) { ListOfEventAssignments x = (s as ListOfEventAssignments).clone(); c = x; } else if (c is ListOfEvents) { ListOfEvents x = (s as ListOfEvents).clone(); c = x; } else if (c is ListOfFunctionDefinitions) { ListOfFunctionDefinitions x = (s as ListOfFunctionDefinitions).clone(); c = x; } else if (c is ListOfInitialAssignments) { ListOfInitialAssignments x = (s as ListOfInitialAssignments).clone(); c = x; } else if (c is ListOfParameters) { ListOfParameters x = (s as ListOfParameters).clone(); c = x; } else if (c is ListOfReactions) { ListOfReactions x = (s as ListOfReactions).clone(); c = x; } else if (c is ListOfRules) { ListOfRules x = (s as ListOfRules).clone(); c = x; } else if (c is ListOfSpecies) { ListOfSpecies x = (s as ListOfSpecies).clone(); c = x; } else if (c is ListOfSpeciesReferences) { ListOfSpeciesReferences x = (s as ListOfSpeciesReferences).clone(); c = x; } else if (c is ListOfSpeciesTypes) { ListOfSpeciesTypes x = (s as ListOfSpeciesTypes).clone(); c = x; } else if (c is ListOfUnitDefinitions) { ListOfUnitDefinitions x = (s as ListOfUnitDefinitions).clone(); c = x; } else if (c is ListOfUnits) { ListOfUnits x = (s as ListOfUnits).clone(); c = x; } else { ERR("[testClone] Error: (" + ename + ") : clone() failed."); return; } if (c == null) { ERR("[testClone] Error: (" + ename + ") : clone() failed."); return; } string enameClone = c.getElementName(); if (ename == enameClone) { //Console.Out.WriteLine("[testClone] OK: (" + ename + ") clone(" + enameClone + ") : type match."); OK(); } else { ERR("[testClone] Error: (" + ename + ") clone(" + enameClone + ") : type mismatch."); } }
public void GivenAValidCompartmentSearchWithNullResourceType_WhenCreated_ThenCorrectCompartmentSearchExpressionShouldBeGenerated(CompartmentType compartmentType, string compartmentId) { SearchOptions options = CreateSearchOptions( resourceType: null, queryParameters: null, compartmentType.ToString(), compartmentId); Assert.NotNull(options); ValidateCompartmentSearchExpression(options.Expression, compartmentType.ToString(), compartmentId); }
public void GivenAValidCompartmentSearch_WhenCreated_ThenCorrectCompartmentSearchExpressionShouldBeGenerated(ResourceType resourceType, CompartmentType compartmentType, string compartmentId) { SearchOptions options = CreateSearchOptions( resourceType: resourceType.ToString(), queryParameters: null, compartmentType.ToString(), compartmentId); Assert.NotNull(options); ValidateMultiaryExpression( options.Expression, MultiaryOperator.And, e => ValidateResourceTypeSearchParameterExpression(e, resourceType.ToString()), e => ValidateCompartmentSearchExpression(e, compartmentType.ToString(), compartmentId)); }
public static ResourceType CompartmentTypeToResourceType(CompartmentType compartmentType) { EnsureArg.IsTrue(Enum.IsDefined(typeof(CompartmentType), compartmentType), nameof(compartmentType)); return(ModelInfo.FhirTypeNameToResourceType(compartmentType.ToString()).Value); }
static void testListOfRemove(ListOf lof, SBase s) { string ename = s.getElementName(); lof.append(s); SBase c = lof.get(0); if (c is CompartmentType) { CompartmentType x = (lof as ListOfCompartmentTypes).remove(0); c = x; } else if (c is Compartment) { Compartment x = (lof as ListOfCompartments).remove(0); c = x; } else if (c is Constraint) { Constraint x = (lof as ListOfConstraints).remove(0); c = x; } else if (c is EventAssignment) { EventAssignment x = (lof as ListOfEventAssignments).remove(0); c = x; } else if (c is Event) { Event x = (lof as ListOfEvents).remove(0); c = x; } else if (c is FunctionDefinition) { FunctionDefinition x = (lof as ListOfFunctionDefinitions).remove(0); c = x; } else if (c is InitialAssignment) { InitialAssignment x = (lof as ListOfInitialAssignments).remove(0); c = x; } else if (c is Parameter) { Parameter x = (lof as ListOfParameters).remove(0); c = x; } else if (c is Reaction) { Reaction x = (lof as ListOfReactions).remove(0); c = x; } else if (c is Rule) { Rule x = (lof as ListOfRules).remove(0); c = x; } else if (c is Species) { Species x = (lof as ListOfSpecies).remove(0); c = x; } else if (c is SpeciesReference) { SimpleSpeciesReference x = (lof as ListOfSpeciesReferences).remove(0); c = x; } else if (c is SpeciesType) { SpeciesType x = (lof as ListOfSpeciesTypes).remove(0); c = x; } else if (c is UnitDefinition) { UnitDefinition x = (lof as ListOfUnitDefinitions).remove(0); c = x; } else if (c is Unit) { Unit x = (lof as ListOfUnits).remove(0); c = x; } else { ERR("[testListOfRemove] Error: (" + ename + ") : ListOfXXX::remove() failed."); return; } if (c == null) { ERR("[testListOfRemove] Error: (" + ename + ") : ListOfXXX::remove() failed."); return; } string enameGet = c.getElementName(); if (ename == enameGet) { //Console.Out.WriteLine("[testListOfRemove] OK: (" + ename + ") remove(" + enameGet + ") : type match."); OK(); } else { ERR("[testListOfRemove] Error: (" + ename + ") remove(" + enameGet + ") : type mismatch."); } }
public void GivenSearchIndicesWithResourceTypeAndCompartmentType_WhenExtracted_ThenCorrectIndicesExtracted(ResourceType resourceType, CompartmentType compartmentType, string resourceId) { var compartmentManager = Substitute.For <ICompartmentDefinitionManager>(); var compartmentIndexer = new CompartmentIndexer(compartmentManager); HashSet <string> compParams = null; compartmentManager.TryGetSearchParams(resourceType, compartmentType, out compParams) .Returns(x => { x[2] = new HashSet <string> { "testParam" }; return(true); }); var searchIndexEntries = new List <SearchIndexEntry> { new SearchIndexEntry("testParam", new ReferenceSearchValue(ReferenceKind.Internal, new Uri("http://localhost"), CompartmentDefinitionManager.CompartmentTypeToResourceType(compartmentType), resourceId)) }; CompartmentIndices compartmentIndices = compartmentIndexer.Extract(resourceType, searchIndexEntries); IReadOnlyCollection <string> resourceIds = null; if (compartmentType == CompartmentType.Device) { resourceIds = compartmentIndices.DeviceCompartmentEntry; } else if (compartmentType == CompartmentType.Encounter) { resourceIds = compartmentIndices.EncounterCompartmentEntry; } else if (compartmentType == CompartmentType.Patient) { resourceIds = compartmentIndices.PatientCompartmentEntry; } else if (compartmentType == CompartmentType.Practitioner) { resourceIds = compartmentIndices.PractitionerCompartmentEntry; } else if (compartmentType == CompartmentType.RelatedPerson) { resourceIds = compartmentIndices.RelatedPersonCompartmentEntry; } Assert.Single(resourceIds); Assert.Contains(resourceId, resourceIds); }
public void CompartmentTypeElement(Hashtable attrs) { CompartmentType compType = new CompartmentType(this.model, attrs); this.model.listOfCompartmentTypes.Add(compType); }