Esempio n. 1
0
            public void ShouldProvide0ForSameId()
            {
                // arrange
                var targetId        = Faker.Random.Int();
                var stronglyTypedId = new IntFor <Order>(targetId);

                // act
                var result = stronglyTypedId.CompareTo(stronglyTypedId);

                // assert
                result.Should().Be(0);
            }
Esempio n. 2
0
            public void ShouldProvide1WhenCompareToNullEntityId()
            {
                // arrange
                var targetId        = Faker.Random.Int();
                var stronglyTypedId = new IntFor <Order>(targetId);


                // act
                var result = stronglyTypedId.CompareTo((IEntityId <Order, int>)null);

                // assert
                result.Should().Be(1);
            }
Esempio n. 3
0
            public void ShouldThrowWhenCompareWithNoEntityId()
            {
                // arrange
                var targetId        = Faker.Random.Int();
                var stronglyTypedId = new IntFor <Order>(targetId);
                var someObject      = new Order();

                // act
                Func <int> act = () => stronglyTypedId.CompareTo(someObject);

                // assert
                act.Should().Throw <ArgumentException>();
            }
Esempio n. 4
0
            public void ShouldProvideSameResultAsBaseIdsDoForEntityId()
            {
                // arrange
                var stronglyTypedId        = new IntFor <Order>(Faker.Random.Int());
                var anotherStronglyTypedId = new IntFor <Order>(Faker.Random.Int());

                // act
                var result1 = stronglyTypedId.CompareTo((IEntityId <Order, int>)anotherStronglyTypedId);
                var result2 = anotherStronglyTypedId.CompareTo((IEntityId <Order, int>)stronglyTypedId);

                var baseResult1 = stronglyTypedId.Value.CompareTo(anotherStronglyTypedId.Value);
                var baseResult2 = anotherStronglyTypedId.Value.CompareTo(stronglyTypedId.Value);

                // assert
                result1.Should().Be(baseResult1);
                result2.Should().Be(baseResult2);
            }