/////////////////////////////////////////////////////////////////////// void FeatherAndWriteAssembly() { var callback = new NpcFeatherCallback(); var feather = new NpcInjectionFeather(callback); feather.Execute(this.assembly.MainModule, OutputFileName); this.assembly.Write(ModifiedOutputFileName, new WriterParameters()); }
public void TestTypeFiltering() { var callback = new NpcFeatherCallback(); var feather = new NpcInjectionFeather(callback); feather.Execute(this.assembly.MainModule, OutputFileName); Action <string> assertContains = typeName => { Assert.IsTrue(callback.TypeInfos.Any(typeInfo => typeInfo.Item1 == "FeatherSharp.Test.Resources." + typeName), "Type " + typeName + " was not processed"); }; Action <string> assertNotContains = typeName => { Assert.IsFalse(callback.TypeInfos.Any(typeInfo => typeInfo.Item1 == "FeatherSharp.Test.Resources." + typeName), "Type " + typeName + " was processed by mistake"); }; assertContains("TestClass1"); assertContains("TestClassWithBase"); assertContains("TestClassBase"); assertContains("TestClassWithouthInpc"); assertContains("TestClassWithouthRaiseMethod"); assertContains("TestClassWithOverride"); assertContains("TestClassWithInaccessibleRaiseMethod"); assertContains("TestClassWithInaccessibleRaiseMethodBase"); assertContains("TestClassWithDependenciesBase"); assertContains("TestClassWithDependencies"); assertContains("TestClassWithDependencies"); assertContains("TestClassContainer"); assertContains("TestClassContainer/Nested"); assertNotContains("TestClassWithOverrideBase"); }