/// <summary> /// Test whether marshalled objects can be made /// </summary> /// <param name="objectMarshall"></param> public void SomeMethodWithProxyEneabledParameter(TestObjectMarshall objectMarshall) { //Do something with this object objectMarshall.SomeEmptyMethod(); objectMarshall.SomeMathMethod(); objectMarshall.SomeMethodWithSimpleParameter("AlaMakota", 9999, 2.0); return; }
/// <summary> /// Test whether marshalled objects can be made /// </summary> /// <param name="objectMarshall"></param> public void SomeMethodWithProxyEneabledParameter(TestObjectMarshall objectMarshall) { //Do something with this object objectMarshall.SomeEmptyMethod(); objectMarshall.SomeMathMethod(); objectMarshall.SomeMethodWithSimpleParameter("AlaMakota",9999,2.0); return; }
private long TimeTestCreation(CreateObjectDelegate @delegate, TestObjectMarshall testObject, AppDomain appDomain, string exeAssembly) { _stopwatch.Reset(); _stopwatch.Start(); for (int i = 0; i < _repeatNumber; i++) { _mbrt = @delegate.Invoke(testObject, appDomain, exeAssembly); } _stopwatch.Stop(); return(_stopwatch.ElapsedMilliseconds); }
public TestRunner(decimal repeatNumber) { _repeatNumber = repeatNumber; _mbrt = null; }
private long TimeTestCreation(CreateObjectDelegate @delegate ,TestObjectMarshall testObject, AppDomain appDomain, string exeAssembly) { _stopwatch.Reset(); _stopwatch.Start(); for (int i = 0; i < _repeatNumber; i++ ) { _mbrt = @delegate.Invoke(testObject, appDomain, exeAssembly); } _stopwatch.Stop(); return _stopwatch.ElapsedMilliseconds; }
public void RunTests() { // Get and display the friendly name of the default AppDomain. string exeAssembly; AppDomain ad2; PrepareCreators(); string callingDomainName = SetUpTestEviorment(out exeAssembly, out ad2); foreach (var creator in _creators) { //Testing the creation time within the specified creators long elapsedCreationTime = 0; elapsedCreationTime = TimeTestCreation(creator.CreateObject, _mbrt, ad2, exeAssembly); Logger.Info("Creating {0} | " + elapsedCreationTime + "ms", creator.GetType().Name); //Testing the invoking time for all methods in TestObjectMarshall //TODO make filtering foreach (var methodInfo in typeof(TestObjectMarshall).GetMethods()) { long elapsedMiliseconds = 0; //Test single method in a TestObjectClass if (methodInfo.GetParameters().Length == 0) { elapsedMiliseconds = TimeTestMethodCall(() => methodInfo.Invoke(_mbrt, new object[] { })); } if ((methodInfo.GetParameters().Length == 1) && (methodInfo.GetParameters()[0].ParameterType.Equals(typeof(String)))) { elapsedMiliseconds = TimeTestMethodCall(() => methodInfo.Invoke(_mbrt, new object[] { callingDomainName })); } if ((methodInfo.GetParameters().Length == 3) && methodInfo.Name.Equals("SomeMethodWithSimpleParameter")) { elapsedMiliseconds = TimeTestMethodCall(() => methodInfo.Invoke(_mbrt, new object[] { "AlaMakota", 10, 10.0 })); } if ((methodInfo.GetParameters().Length == 1) && methodInfo.Name.Equals("SomeMethodWithSerializabeParameter")) { elapsedMiliseconds = TimeTestMethodCall( () => methodInfo.Invoke(_mbrt, new object[] { new SerializableClass() { Field1 = "field1", Field2 = 1, Field3 = 1.0 } })); } if ((methodInfo.GetParameters().Length == 1) && methodInfo.Name.Equals("SomeMethodWithProxyEneabledParameter")) { //Performed marshalled creation in domian C TestObjectMarshall objectMarshall = null; objectMarshall = new MarshalledCreation().CreateObject(objectMarshall, AppDomain.CreateDomain("Domain C"), exeAssembly); elapsedMiliseconds = TimeTestMethodCall( () => methodInfo.Invoke(_mbrt, new object[] { objectMarshall })); } Logger.Info("Invoking {0} within class {1} | " + elapsedMiliseconds + "ms", methodInfo.Name, methodInfo.MemberType.GetType().Name); } } }