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); }
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); }
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>(); }
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); }