public void Returns_Unique_Identifier_For_DifferentTypes() { IObjectIdGenerator <ulong> generator1 = new ULongObjectIdGenerator <PersonViewModel3>(); IObjectIdGenerator <ulong> generator2 = new ULongObjectIdGenerator <PersonViewModel4>(); Assert.AreEqual(generator1.GetUniqueIdentifier(), generator2.GetUniqueIdentifier()); }
public void Returns_New_UniqueIdentifier_Even_If_Are_Generated_By_Different_Instances() { IObjectIdGenerator <ulong> generator1 = new ULongObjectIdGenerator <PersonViewModel1>(); IObjectIdGenerator <ulong> generator2 = new ULongObjectIdGenerator <PersonViewModel1>(); Assert.AreNotEqual(generator1.GetUniqueIdentifier(), generator2.GetUniqueIdentifier()); }
public void Returns_A_Unique_Identifier_Even_When_An_Instance_Is_Released_But_Reuse_Is_False() { var generator = new ULongObjectIdGenerator <PersonViewModel2>(); var uniqueIdentifierForInstance = generator.GetUniqueIdentifierForInstance(new PersonViewModel2()); GC.Collect(); Assert.AreNotEqual(uniqueIdentifierForInstance, generator.GetUniqueIdentifierForInstance(new PersonViewModel2())); }
public void Returns_A_Released_Identifier_If_Requested() { IObjectIdGenerator <ulong> generator = new ULongObjectIdGenerator <PersonViewModel2>(); var uniqueIdentifier = generator.GetUniqueIdentifier(); generator.ReleaseIdentifier(uniqueIdentifier); Assert.AreEqual(uniqueIdentifier, generator.GetUniqueIdentifier(true)); }
public void Returns_A_Released_Identifier_If_The_Instance_Is_Released_And_Reuse_Is_True() { var generator = new ULongObjectIdGenerator <PersonViewModel1>(); var uniqueIdentifierForInstance = generator.GetUniqueIdentifierForInstance(new PersonViewModel1()); GC.Collect(); Assert.AreEqual(uniqueIdentifierForInstance, generator.GetUniqueIdentifierForInstance(new PersonViewModel1(), true)); }
public void Returns_A_Unique_Identifier_For_Different_Instances() { var generator = new ULongObjectIdGenerator <PersonViewModel3>(); Assert.AreNotEqual(generator.GetUniqueIdentifierForInstance(new PersonViewModel3()), generator.GetUniqueIdentifierForInstance(new PersonViewModel3())); }