public void ConvertFrom_String() { ParameterizedTest<string, OutlinerVersion> tester = new ParameterizedTest<string, OutlinerVersion>(); tester.Method = delegate(string input) { OutlinerVersionConverter converter = new OutlinerVersionConverter(); return converter.ConvertFrom(input) as OutlinerVersion; }; tester.Test("1.0.0", new OutlinerVersion(1, 0, 0)); tester.Test("1.0.0 ", new OutlinerVersion(1, 0, 0)); tester.Test("1.0.0 alpha", new OutlinerVersion(1, 0, 0, ReleaseStage.Alpha)); tester.Test("1.0.0 beta", new OutlinerVersion(1, 0, 0, ReleaseStage.Beta)); tester.Test("2.3.4", new OutlinerVersion(2, 3, 4)); }
public void CompareTo() { ParameterizedTest<OutlinerVersion, OutlinerVersion, int> tester = new ParameterizedTest<OutlinerVersion, OutlinerVersion, int>(); tester.Method = delegate(OutlinerVersion vX, OutlinerVersion vY) { return vX.CompareTo(vY); }; tester.Test(new OutlinerVersion(), null, 1); tester.Test(new OutlinerVersion(), new OutlinerVersion(), 0); tester.Test(new OutlinerVersion(1, 0, 0), new OutlinerVersion(2, 0, 0), -1); tester.Test(new OutlinerVersion(1, 0, 0), new OutlinerVersion(1, 1, 0), -1); tester.Test(new OutlinerVersion(1, 0, 0), new OutlinerVersion(1, 0, 1), -1); tester.Test(new OutlinerVersion(1, 0, 0, ReleaseStage.Alpha), new OutlinerVersion(1, 0, 0, ReleaseStage.Beta), -1); tester.Test(new OutlinerVersion(1, 0, 0, ReleaseStage.Beta), new OutlinerVersion(1, 0, 0, ReleaseStage.Release), -1); tester.Test(new OutlinerVersion(2, 0, 0), new OutlinerVersion(1, 0, 0, 0), 1); }