public void MinAndMaxWithVersions(string strVersionFirst, string strVersionSecond) { Version verFirst = strVersionFirst == null ? null : new Version(strVersionFirst); Version verSecond = strVersionSecond == null ? null : new Version(strVersionSecond); Version verExpectedMax = verFirst == null ? verSecond : verSecond == null ? verFirst : verFirst >= verSecond ? verFirst : verSecond; Version verMax = ComparisonUtility.Max(verFirst, verSecond); Assert.AreEqual(verExpectedMax, verMax); Version verExpectedMin = verFirst == null ? verFirst : verSecond == null ? verSecond : verFirst <= verSecond ? verFirst : verSecond; Version verMin = ComparisonUtility.Min(verFirst, verSecond); Assert.AreEqual(verExpectedMin, verMin); if (verFirst != null && verFirst.Equals(verSecond)) { Assert.AreSame(verFirst, verMax); Assert.AreSame(verFirst, verMin); } }
public void MinAndMaxWithInt32s(int nFirst, int nSecond) { Assert.AreEqual(Math.Min(nFirst, nSecond), ComparisonUtility.Min(nFirst, nSecond)); Assert.AreEqual(Math.Max(nFirst, nSecond), ComparisonUtility.Max(nFirst, nSecond)); }