Exemplo n.º 1
0
            public void Returns_A_Unique_Identifier_Even_When_An_Instance_Is_Released_But_Reuse_Is_False()
            {
                GuidObjectIdGenerator <PersonViewModel2> generator = new GuidObjectIdGenerator <PersonViewModel2>();
                var uniqueIdentifierForInstance = generator.GetUniqueIdentifierForInstance(new PersonViewModel2());

                GC.Collect();
                GC.WaitForPendingFinalizers();

                Assert.AreNotEqual(uniqueIdentifierForInstance, generator.GetUniqueIdentifierForInstance(new PersonViewModel2()));
            }
Exemplo n.º 2
0
            public void Returns_A_Released_Identifier_If_The_Instance_Is_Released_And_Reuse_Is_True()
            {
                GuidObjectIdGenerator <PersonViewModel1> generator = new GuidObjectIdGenerator <PersonViewModel1>();
                var uniqueIdentifierForInstance = generator.GetUniqueIdentifierForInstance(new PersonViewModel1());

                GC.Collect();
                GC.WaitForPendingFinalizers();

                Assert.AreEqual(uniqueIdentifierForInstance, generator.GetUniqueIdentifierForInstance(new PersonViewModel1(), true));
            }
Exemplo n.º 3
0
            public void Returns_A_Unique_Identifier_For_Different_Instances()
            {
                GuidObjectIdGenerator <PersonViewModel3> generator = new GuidObjectIdGenerator <PersonViewModel3>();

                Assert.AreNotEqual(generator.GetUniqueIdentifierForInstance(new PersonViewModel3()), generator.GetUniqueIdentifierForInstance(new PersonViewModel3()));
            }