public void TestBasicNpcInjection() { var callback = new NpcFeatherCallback(); var featherImpl = new NpcInjectionRunner(this.assembly.MainModule, callback); var type = this.assembly.MainModule.GetType("FeatherSharp.Test.Resources.TestClass1"); featherImpl.ProcessType(type); CollectionAssert.AreEqual( Tuple.Create("FeatherSharp.Test.Resources.TestClass1", NpcInjectionTypeInfo.Ok).Singleton(), callback.TypeInfos); CollectionAssert.AreEquivalent( new[] { Tuple.Create("TestProperty_Int", NpcInjectionPropertyInfo.Ok), Tuple.Create("TestProperty_Object", NpcInjectionPropertyInfo.Ok), Tuple.Create("TestProperty_Struct", NpcInjectionPropertyInfo.Ok), Tuple.Create("TestProperty_String", NpcInjectionPropertyInfo.Ok), Tuple.Create("TestProperty_Complex", NpcInjectionPropertyInfo.NoEqualityCheckInjected), Tuple.Create("TestProperty_WithBodies", NpcInjectionPropertyInfo.Ok), Tuple.Create("TestProperty_WithRaise", NpcInjectionPropertyInfo.AlreadyCallsRaiseMethod), }, callback.PropertyInfos); }
public void TestTypeWithDependencies() { var callback = new NpcFeatherCallback(); var featherImpl = new NpcInjectionRunner(this.assembly.MainModule, callback); var type = this.assembly.MainModule.GetType("FeatherSharp.Test.Resources.TestClassWithDependencies"); featherImpl.ProcessType(type); CollectionAssert.AreEqual( Tuple.Create("FeatherSharp.Test.Resources.TestClassWithDependencies", NpcInjectionTypeInfo.OkWithDependencies).Singleton(), callback.TypeInfos); CollectionAssert.AreEquivalent( Tuple.Create("C", NpcInjectionPropertyInfo.Ok).Singleton(), callback.PropertyInfos); CollectionAssert.AreEqual( new[] { Tuple.Create("D", "A,C"), Tuple.Create("E", "D,B"), }, callback.PropertyDependencies); }
public void TestInaccessibleRaiseMethod() { var callback = new NpcFeatherCallback(); var featherImpl = new NpcInjectionRunner(this.assembly.MainModule, callback); var type = this.assembly.MainModule.GetType("FeatherSharp.Test.Resources.TestClassWithInaccessibleRaiseMethod"); featherImpl.ProcessType(type); CollectionAssert.AreEqual( Tuple.Create("FeatherSharp.Test.Resources.TestClassWithInaccessibleRaiseMethod", NpcInjectionTypeInfo.InaccessibleRaiseMethod).Singleton(), callback.TypeInfos); }
public void TestIgnoreProperty() { var callback = new NpcFeatherCallback(); var featherImpl = new NpcInjectionRunner(this.assembly.MainModule, callback); var type = this.assembly.MainModule.GetType("FeatherSharp.Test.Resources.TestClassWithIgnoredProperty"); featherImpl.ProcessType(type); CollectionAssert.AreEqual( new[] { Tuple.Create("MyProperty", NpcInjectionPropertyInfo.Ok), Tuple.Create("MyIgnoredProperty", NpcInjectionPropertyInfo.Ignored), }, callback.PropertyInfos); }
public void TestTypeHierarchy() { var callback = new NpcFeatherCallback(); var featherImpl = new NpcInjectionRunner(this.assembly.MainModule, callback); var type = this.assembly.MainModule.GetType("FeatherSharp.Test.Resources.TestClassWithBase"); featherImpl.ProcessType(type); CollectionAssert.AreEqual( Tuple.Create("FeatherSharp.Test.Resources.TestClassWithBase", NpcInjectionTypeInfo.Ok).Singleton(), callback.TypeInfos); CollectionAssert.AreEqual( Tuple.Create("MyProperty", NpcInjectionPropertyInfo.Ok).Singleton(), callback.PropertyInfos); }