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"); }
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"); }