public void AddTargetObjectTest() { var env = new RPCExecutor(); var cla = new TestClassA(); env.AddTargetObject(cla); var req = new RPCRequest(typeof(int), nameof(TestClassA.Add1), 1); var result = env.Invoke(req); Assert.AreEqual(2, result); }
public void ScopeInjectionTest() { var env = new RPCExecutor(); var cla = new TestClassA(); env.AddTargetObject(cla); var req = new RPCRequest(typeof(int), nameof(TestClassA.Add2), 1); var result = env.Invoke(req, new object[] { new TestClassB(2) }); Assert.AreEqual(3, result); }
public void ExecuteSpecMethodTest() { var env = new RPCExecutor(); var cla = new TestClassA(); env.AddSingleton(cla); env.AddTargetMethod <TestClassA>(x => x.Add1(1)); var req = new RPCRequest(typeof(int), nameof(TestClassA.Add1), 1); var result = env.Invoke(req); Assert.AreEqual(2, result); }
public void GlobalInjectionTest() { var env = new RPCExecutor(); var cla = new TestClassA(); env.AddTargetObject(cla); env.AddSingleton(new TestClassC(3)); var req = new RPCRequest(typeof(int), nameof(TestClassA.Add3), 1); var result = env.Invoke(req, new object[] { new TestClassB(2) }); Assert.AreEqual(6, result); }