Exemplo n.º 1
0
        static void Main(string[] args)
        {
            AssemblynameTreeAndList assemblynameInfo = AssemblynameHelper.Get();

            Console.WriteLine("List:");
            assemblynameInfo.AssemblynameList.OrderBy(an => an.Name).ToList().ForEach(
                an => Console.WriteLine(string.Format("{0}", an.Name))
                );
            Console.WriteLine();

            Console.WriteLine("Flattened tree:");
            assemblynameInfo.Tree.AsFlattened().ToList().ForEach(
                info => Console.WriteLine("{0}\t{1}",
                                          info.AssemblyName.Name,
                                          null == info.ReferencedAssemblyNames
                        ? "null"
                        : info.ReferencedAssemblyNames.Count().ToString()
                                          )
                );
            Console.WriteLine();

            Console.WriteLine();
            Console.Write("Press any key");
            Console.ReadKey();
        }
Exemplo n.º 2
0
        // ReSharper disable InconsistentNaming
        public void GetTest_Void()
        // ReSharper restore InconsistentNaming
        {
            //  See http://social.msdn.microsoft.com/Forums/eu/vststest/thread/7ff8caae-56c6-4baa-94c9-7224f69dbd17
            //  and http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getentryassembly.aspx
            var res = AssemblynameHelper.Get();

            Assert.IsNull(res, "There is no EntryAssembly for unit test.  How should one test this? through an external exe?");
        }
        public void AsFlattenedTest()
        {
            AssemblynameTreeAndList assemblynameInfo = AssemblynameHelper.Get(Assembly.GetExecutingAssembly());
            var res = assemblynameInfo.Tree.AsFlattened();

            Assert.IsTrue(res.Count() > 1);

            AssemblyName assemblyname = Assembly.GetExecutingAssembly().GetName();
            var          target       = new AssemblynameHelper.AssemblynameNode(assemblyname);

            res = target.AsFlattened();
            Assert.AreEqual(1, res.Count());
        }
        public void ReferencedAssemblyNamesTest()
        {
            AssemblyName assemblyname = Assembly.GetExecutingAssembly().GetName();
            var          target       = new AssemblynameHelper.AssemblynameNode(assemblyname);
            var          res          = target.ReferencedAssemblyNames;

            Assert.IsNull(res);

            AssemblynameTreeAndList assemblynameInfo = AssemblynameHelper.Get(Assembly.GetExecutingAssembly());
            var q = assemblynameInfo.Tree.AsFlattened().Where(ani => ani.ReferencedAssemblyNames != null);

            Assert.IsTrue(q.Count() >= 1, "There should be at least one referenced assembly from whatever executed this DLL, shouldn't there?");
        }
 // ReSharper disable InconsistentNaming
 public void GetTest_Void()
 // ReSharper restore InconsistentNaming
 {
     Assert.Inconclusive("TBA");
     var res = AssemblynameHelper.Get();
 }
Exemplo n.º 6
0
 // ReSharper disable InconsistentNaming
 public void GetTest_Assembly()
 // ReSharper restore InconsistentNaming
 {
     var res = AssemblynameHelper.Get((Assembly)null);
 }