Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypedIdValueBase Equals Method #235

Open
dsteindd opened this issue Dec 20, 2021 · 0 comments
Open

TypedIdValueBase Equals Method #235

dsteindd opened this issue Dec 20, 2021 · 0 comments

Comments

@dsteindd
Copy link

Hi there,

I noticed that it is possible to have equality of two different implementations of the TypedIdValueBase, if the underlying Guid is the same. I think, this shouldn't be the case, should it?

For example, I would expect this test to turn green:

public class DifferentTypedIdWithSameGuidTests
{
     [Test]
     public void Test()
     {
         var commonId = Guid.NewGuid();

         var firstId = new FirstEntityId(commonId);
         var secondId = new SecondEntityId(commonId);

         Assert.False(firstId.Equals(secondId));
     }
 }

public class FirstEntityId : TypedIdValueBase
{
     public FirstEntityId(Guid value)
         : base(value)
     {
     }
 }
    
 public class SecondEntityId : TypedIdValueBase
 {
     public SecondEntityId(Guid value)
         : base(value)
     {
     }
 }

Best regards,
David

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant