Exemplo n.º 1
0
        public void NoChangeTest()
        {
            ILStrip.ILStrip strip = new ILStrip.ILStrip(TestHelper.TranslatePath("ILStripTest.dll"));

            strip.ScanUsedClasses();
            strip.ScanUnusedClasses();

            AssemblyDefinition def = SaveAssembly(strip);

            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.RegularClass");
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.EmptyClass");
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.EmptyClass2");
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.Form1");
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.ClassWithNestedClass");
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.ClassWithNestedClass/NestedClass");
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.ClassWithNestedClass2/NestedClass");
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.Form1");
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.CustomAttribute");
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.ClassWithGeneric");
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.IInterface");
            AssemblyAsserts.AssertResource(def, "ILStripTest.Form1.resources");
            AssemblyAsserts.AssertReference(def, "mscorlib");
            AssemblyAsserts.AssertReference(def, "System.Drawing");
            AssemblyAsserts.AssertReference(def, "System.Windows.Forms");
        }
Exemplo n.º 2
0
        public void MakeInternalTest()
        {
            ILStrip.ILStrip strip = new ILStrip.ILStrip(TestHelper.TranslatePath("ILStripTest.dll"));
            strip.EntryPoints.Add("ILStripTest.Form1");
            strip.EntryPoints.Add("ILStripTest.RegularClass");
            strip.EntryPoints.Add("ILStripTest.ClassWithNestedClass");
            strip.MakeInternalExclusions.Add("ILStripTest.EmptyClass");
            strip.MakeInternalExclusions.Add("ILStripTest.ClassWithNestedClass");

            strip.ScanUsedClasses();
            strip.ScanUnusedClasses();
            strip.CleanupUnusedClasses();
            strip.CleanupUnusedResources();
            strip.CleanupUnusedReferences();
            strip.MakeNotPublic();

            AssemblyDefinition def = SaveAssembly(strip);

            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.RegularClass", false);
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.EmptyClass", true);
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.EmptyClass2", false);
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.Form1", false);
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.ClassWithNestedClass", true);
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.CustomAttribute", false);
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.IInterface", false);
            AssemblyAsserts.AssertResource(def, "ILStripTest.Form1.resources");
            AssemblyAsserts.AssertReference(def, "mscorlib");
            AssemblyAsserts.AssertReference(def, "System.Drawing");
            AssemblyAsserts.AssertReference(def, "System.Windows.Forms");
        }
Exemplo n.º 3
0
        public void CleanupUnusedResourcesTest()
        {
            ILStrip.ILStrip strip = new ILStrip.ILStrip(TestHelper.TranslatePath("ILStripTest.dll"));

            strip.ScanUsedClasses();
            strip.ScanUnusedClasses();
            strip.CleanupUnusedResources();

            AssemblyDefinition def = SaveAssembly(strip);

            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.RegularClass");
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.EmptyClass");
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.EmptyClass2");
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.Form1");
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.ClassWithNestedClass");
            AssemblyAsserts.AssertClassPublic(def, "ILStripTest.ClassWithNestedClass2");
            AssemblyAsserts.AssertNoResource(def, "ILStripTest.Form1.resources");
            AssemblyAsserts.AssertReference(def, "mscorlib");
            AssemblyAsserts.AssertReference(def, "System.Drawing");
            AssemblyAsserts.AssertReference(def, "System.Windows.Forms");
        }