public void ShouldGenerateUniqueId()
 {
     const int ObjectsNo = 100000;
     var identifier = new ObjectIdentifier();
     var objects = new object[ObjectsNo];
     for(var i = 0; i < objects.Length; i++)
     {
         objects[i] = new object();
     }
     var generated = new HashSet<int>();
     foreach(var obj in objects)
     {
         var id = identifier.GetId(obj);
         Assert.IsTrue(generated.Add(id), "Not unique ID was generated.");
     }
 }
Exemple #2
0
        public void ShouldGenerateUniqueId()
        {
            const int ObjectsNo  = 100000;
            var       identifier = new ObjectIdentifier();
            var       objects    = new object[ObjectsNo];

            for (var i = 0; i < objects.Length; i++)
            {
                objects[i] = new object();
            }
            var generated = new HashSet <int>();

            foreach (var obj in objects)
            {
                var id = identifier.GetId(obj);
                Assert.IsTrue(generated.Add(id), "Not unique ID was generated.");
            }
        }