Skip to content

Commit

Permalink
Added negative value checking to BioProcess.Check (#1372)
Browse files Browse the repository at this point in the history
* Added negative value checking to BioProcess.Check

* Performed requested changes

* Changed to var

* Fixed code cleanup check

* Removed redundant toString() call

Co-authored-by: Corey Hendrey <[email protected]>
  • Loading branch information
rhythms06 and CoreyHendrey authored Aug 7, 2020
1 parent 22d79a4 commit 6c60489
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/microbe_stage/BioProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,23 @@ public void Check(string name)
throw new InvalidRegistryDataException(name, GetType().Name,
"Process has no inputs AND no outputs");
}

foreach (var input in Inputs)
{
if (input.Value <= 0)
{
throw new InvalidRegistryDataException(name, GetType().Name,
"Non-positive amount of input compound " + input.Key + " found");
}
}

foreach (var output in Outputs)
{
if (output.Value <= 0)
{
throw new InvalidRegistryDataException(name, GetType().Name,
"Non-positive amount of output compound " + output.Key + " found");
}
}
}
}

0 comments on commit 6c60489

Please sign in to comment.