public void SemanticVersion_GetFull() { SemanticVersion partial = new SemanticVersion(1, 2, 3); Assert.IsNotNull(partial); Assert.IsTrue(partial.IsPartial); SemanticVersion full = partial.GetFull(); Assert.IsNotNull(full); Assert.IsFalse(full.IsPartial); Assert.IsTrue(partial.Matches(full)); }
public void SemanticVersion_Matches() { bool success = true; foreach (Tuple <bool, SemanticVersion, SemanticVersion> pair in _matchTests) { bool matchExpected = pair.Item1; SemanticVersion a = pair.Item2; SemanticVersion b = pair.Item3; bool matches = a.Matches(b); Trace.Write( matches ? string.Format("'{0}' matches '{1}'", a, b) : string.Format("'{0}' does not match '{1}'", a, b)); if (matchExpected == matches) { Trace.WriteLine(" as expected"); } else { Trace.WriteLine(" which is not expected"); success = false; } bool converse = b.Matches(a); if (converse != matches) { Trace.WriteLine("The converse failed"); success = false; } } Assert.IsTrue(success, "Some tests failed."); }