public void TestNamespaceContainer_5()
        {
            var nc   = new NamespaceContainer <NameAdapter>();
            var name = "System.Test.Item.";

            Parallel.ForEach(Enumerable.Range(1, 1000), n => nc.Add(new NameAdapter(string.Concat(name, n % 1000))));

            Assert.AreEqual(1000, nc.Count);
        }
        public void TestNamespaceContainer_2()
        {
            var nc   = new NamespaceContainer <NameAdapter>();
            var name = new NameAdapter("System.Test.Item");

            Parallel.ForEach(Enumerable.Range(1, 1000), n => nc.Add(name));

            Assert.AreEqual(1, nc.Count);
        }
        public void TestNamespaceContainer_4()
        {
            var nc = new NamespaceContainer<NameAdapter>();
            var name = "System.Test.Item";

            Parallel.ForEach(Enumerable.Range(1, 10000), n => nc.Add(new NameAdapter(string.Concat(name, n % 1000))));

            Assert.AreEqual(1000, nc.Count);
        }
        public void TestNamespaceContainer_2()
        {
            var nc = new NamespaceContainer<NameAdapter>();
            var name = new NameAdapter("System.Test.Item");

            Parallel.ForEach(Enumerable.Range(1, 1000), n => nc.Add(name));

            Assert.AreEqual(1, nc.Count);
        }
        public void TestNamespaceContainer_6()
        {
            var nc    = new NamespaceContainer <NameAdapter>();
            var name  = new NameAdapter("System.Test.Item");
            var count = 0;

            Parallel.ForEach(
                Enumerable.Range(1, 10000),
                n =>
            {
                if (!nc.Contains(name))
                {
                    nc.Add(name);
                    count++;
                }
            });

            Assert.AreEqual(count, nc.Count);
        }
Exemple #6
0
        /// <summary>
        /// </summary>
        /// <returns>
        /// </returns>
        public ISet<IType> DiscoverAllStaticFieldsDependencies()
        {
            var calledMethods = new NamespaceContainer<IMethod>();
            var readStaticFields = new NamespaceContainer<IField>();

            this.WalkMethod(this.startMethod, calledMethods, readStaticFields);

            var typesWithStaticFields = new NamespaceContainer<IType>();
            foreach (var staticField in readStaticFields)
            {
                if (staticField.DeclaringType.TypeEquals(this.startMethod.DeclaringType))
                {
                    continue;
                }

                typesWithStaticFields.Add(staticField.DeclaringType);
            }

            return typesWithStaticFields;
        }
        public void TestNamespaceContainer_6()
        {
            var nc = new NamespaceContainer<NameAdapter>();
            var name = new NameAdapter("System.Test.Item");
            var count = 0;

            Parallel.ForEach(
                Enumerable.Range(1, 10000),
                n =>
                    {
                        if (!nc.Contains(name))
                        {
                            nc.Add(name);
                            count++;
                        }
                    });

            Assert.AreEqual(count, nc.Count);
        }