public void Single() { RunAll(EqualityUnit .Create(new JobId("test")) .WithEqualValues(new JobId("test"), JobId.ParseName("test")) .WithNotEqualValues(new JobId("test2"), JobId.Root)); }
public void Nested() { RunAll(EqualityUnit .Create(new JobId("test", new JobId("op"))) .WithEqualValues(new JobId("test", new JobId("op")), JobId.ParseName("op/test")) .WithNotEqualValues(new JobId("test"), JobId.Root, new JobId("op"))); }
public void Root() { RunAll(EqualityUnit .Create(JobId.Root) .WithEqualValues(JobId.Root, JobId.ParseName("")) .WithNotEqualValues(new JobId("test"))); }
public static void RunAll <T>( this EqualityUnit <T> unit, bool checkIEquatable) { var util = new EqualityUtil <T>(unit, null, null); util.RunAll(checkIEquatable); }
public void Scheme() { var buildId = new BuildId(42, JobId.ParseName("cat")); RunAll(EqualityUnit .Create(new BoundBuildId("test", buildId, Uri.UriSchemeFtp)) .WithEqualValues(new BoundBuildId("test", buildId, Uri.UriSchemeFtp)) .WithNotEqualValues(new BoundBuildId("other", buildId, Uri.UriSchemeHttps))); }
public EqualityUtil( EqualityUnit <T> equalityUnit, Func <T, T, bool> compEquality = null, Func <T, T, bool> compInequality = null) { _equalityUnit = equalityUnit; _compareWithEqualityOperator = compEquality; _compareWithInequalityOperator = compInequality; }
public static void RunAll <T>( this EqualityUnit <T> unit, Func <T, T, bool> compEqualsOperator, Func <T, T, bool> compNotEqualsOperator) { var util = new EqualityUtil <T>(unit, compEqualsOperator, compNotEqualsOperator); util.RunAll(); }
public void HostName() { var host = new Uri("http://test.com"); var buildId = new BuildId(42, JobId.ParseName("cat")); RunAll(EqualityUnit .Create(new BoundBuildId(host, buildId)) .WithEqualValues(new BoundBuildId(host, buildId), new BoundBuildId(host, buildId)) .WithNotEqualValues(new BoundBuildId(new Uri("http://other.com"), buildId))); }
public void JobIdDifferent() { var id1 = JobId.ParseName("dog"); var id2 = JobId.ParseName("cat"); RunAll(EqualityUnit.Create(new BuildId(42, id1)) .WithEqualValues(new BuildId(42, id1)) .WithNotEqualValues( new BuildId(42, id2), new BuildId(42, JobId.Root))); }
public void Equality() { var date = new DateTime(year: 2016, month: 4, day: 1).ToUniversalTime(); EqualityUnit .Create(new DateKey(date)) .WithEqualValues(new DateKey(date)) .WithNotEqualValues(new DateKey(new DateTime(year: 2016, month: 4, day: 2).ToUniversalTime())) .RunAll( (x, y) => x == y, (x, y) => x != y); }
public void Time() { var date = new DateTimeOffset(year: 2016, month: 4, day: 1, hour: 1, minute: 0, second: 0, offset: TimeSpan.Zero); EqualityUnit .Create(new DateTimeKey(date, DateTimeKeyFlags.Time)) .WithEqualValues( new DateTimeKey(date, DateTimeKeyFlags.Time), new DateTimeKey(date.AddDays(1), DateTimeKeyFlags.Time)) .WithNotEqualValues( new DateTimeKey(date, DateTimeKeyFlags.Date), new DateTimeKey(date.AddHours(1), DateTimeKeyFlags.Time)) .RunAll( (x, y) => x == y, (x, y) => x != y); }
private static void RunAll(EqualityUnit <JobId> unit) { unit.RunAll( compEqualsOperator: (x, y) => x == y, compNotEqualsOperator: (x, y) => x != y); }
public void Number() { RunAll(EqualityUnit.Create(new BuildId(42, JobId.Root)) .WithEqualValues(new BuildId(42, JobId.Root)) .WithNotEqualValues(new BuildId(13, JobId.Root))); }