Exemplo n.º 1
0
        public void ZadanieB()
        {
            SingletonFactory factory = SingletonFactory.CreateSingletonFactory();
            int singletonCount       = 1000000;

            Type[] typeArray          = { typeof(BasicSingleton), typeof(ExtendedSingletonA), typeof(ExtendedSingletonB) };
            ISet <BasicSingleton> set = new HashSet <BasicSingleton>();

            for (int i = 0; i < singletonCount; i++)
            {
                BasicSingleton singleton = factory.CreateSingleton(typeArray[rand.Next(typeArray.Length)]);
                set.Add(singleton);
            }

            Assert.AreEqual(set.Count, 3, "Ilość singletonów różna od 3!");
        }