예제 #1
0
 public void Single()
 {
     RunAll(EqualityUnit
            .Create(new JobId("test"))
            .WithEqualValues(new JobId("test"), JobId.ParseName("test"))
            .WithNotEqualValues(new JobId("test2"), JobId.Root));
 }
예제 #2
0
 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")));
 }
예제 #3
0
 public void Root()
 {
     RunAll(EqualityUnit
            .Create(JobId.Root)
            .WithEqualValues(JobId.Root, JobId.ParseName(""))
            .WithNotEqualValues(new JobId("test")));
 }
예제 #4
0
        public static void RunAll <T>(
            this EqualityUnit <T> unit,
            bool checkIEquatable)
        {
            var util = new EqualityUtil <T>(unit, null, null);

            util.RunAll(checkIEquatable);
        }
예제 #5
0
            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)));
            }
예제 #6
0
 public EqualityUtil(
     EqualityUnit <T> equalityUnit,
     Func <T, T, bool> compEquality   = null,
     Func <T, T, bool> compInequality = null)
 {
     _equalityUnit = equalityUnit;
     _compareWithEqualityOperator   = compEquality;
     _compareWithInequalityOperator = compInequality;
 }
예제 #7
0
        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();
        }
예제 #8
0
            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)));
            }
예제 #9
0
            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)));
            }
예제 #10
0
        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);
        }
예제 #11
0
            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);
            }
예제 #12
0
 private static void RunAll(EqualityUnit <JobId> unit)
 {
     unit.RunAll(
         compEqualsOperator: (x, y) => x == y,
         compNotEqualsOperator: (x, y) => x != y);
 }
예제 #13
0
 public void Number()
 {
     RunAll(EqualityUnit.Create(new BuildId(42, JobId.Root))
            .WithEqualValues(new BuildId(42, JobId.Root))
            .WithNotEqualValues(new BuildId(13, JobId.Root)));
 }