public void Validation() { UcumTestSet tests = new UcumTestSet(); foreach (UcumTestSet.Validation v in tests.Validations()) { try { Metric m = system.Metric(v.Unit); if (!v.Valid) { throw new AssertFailedException(string.Format($"Test {v.Id} succeeded, but should not have. Reason: '{v.Reason}'")); } } catch (Exception e) { if (e is AssertFailedException) { throw; } else if (v.Valid) { throw new Exception(string.Format("Test {0} failed", v.Id)); } } } }
public void Validation() { UcumTestSet reader = new UcumTestSet(); foreach (UcumTestSet.Validation v in reader.Validations()) { try { Metric m = system.Metric(v.Unit); if (!v.Valid) throw new AssertFailedException(string.Format("Test {0} succeeded, but should not have", v.Id)); } catch (Exception e) { if (e is AssertFailedException) throw; else if (v.Valid) throw new Exception(string.Format("Test {0} failed", v.Id)); } } }