public void ShouldProvide0ForSameId() { // arrange var targetId = Faker.Random.Long(); var stronglyTypedId = new LongFor <Order>(targetId); // act var result = stronglyTypedId.CompareTo(stronglyTypedId); // assert result.Should().Be(0); }
public void ShouldProvide1WhenCompareToNullEntityId() { // arrange var targetId = Faker.Random.Long(); var stronglyTypedId = new LongFor <Order>(targetId); // act var result = stronglyTypedId.CompareTo((IEntityId <Order, long>)null); // assert result.Should().Be(1); }
public void ShouldThrowWhenCompareWithNoEntityId() { // arrange var targetId = Faker.Random.Long(); var stronglyTypedId = new LongFor <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 LongFor <Order>(Faker.Random.Long()); var anotherStronglyTypedId = new LongFor <Order>(Faker.Random.Long()); // act var result1 = stronglyTypedId.CompareTo((IEntityId <Order, long>)anotherStronglyTypedId); var result2 = anotherStronglyTypedId.CompareTo((IEntityId <Order, long>)stronglyTypedId); var baseResult1 = stronglyTypedId.Value.CompareTo(anotherStronglyTypedId.Value); var baseResult2 = anotherStronglyTypedId.Value.CompareTo(stronglyTypedId.Value); // assert result1.Should().Be(baseResult1); result2.Should().Be(baseResult2); }