public void GetObjectIsThreadSafe() { ObjectFactory = CreateObjectFactory(true); GenericObjectDefinition theSpouse = new GenericObjectDefinition(); theSpouse.ObjectTypeName = typeof(TestObject).FullName; theSpouse.IsSingleton = false; ObjectFactory.RegisterObjectDefinition("theSpouse", theSpouse); GenericObjectDefinition theObject = new GenericObjectDefinition(); theObject.ObjectTypeName = typeof(TestObject).FullName; theObject.IsSingleton = false; theObject.PropertyValues.Add("Spouse", theSpouse); ObjectFactory.RegisterObjectDefinition("theObject", theObject); AsyncTestTask t1 = new AsyncTestMethod(20000, new ThreadStart(GetTheTestObject)).Start(); AsyncTestTask t2 = new AsyncTestMethod(20000, new ThreadStart(GetTheTestObject)).Start(); AsyncTestTask t3 = new AsyncTestMethod(20000, new ThreadStart(GetTheTestObject)).Start(); AsyncTestTask t4 = new AsyncTestMethod(20000, new ThreadStart(GetTheTestObject)).Start(); t1.AssertNoException(); t2.AssertNoException(); t3.AssertNoException(); t4.AssertNoException(); }
public static void CanAccessContextFromNonWebThreadImpl() { IApplicationContext ctx; ctx = WebApplicationContext.GetRootContext(); AsyncTestMethod testMethod = new AsyncTestMethod(1, new AsyncTestMethod.TestMethod(DoBackgroundWork), ctx); testMethod.Start(); testMethod.AssertNoException(); }
public void CurrentProxyIsThreadSafe() { ProxyTestObjectAndExposeProxy(); AsyncTestMethod t1 = new AsyncTestMethod(1000, new ThreadStart(ProxyTestObjectAndExposeProxy)); AsyncTestMethod t2 = new AsyncTestMethod(1000, new ThreadStart(ProxyTestObjectAndExposeProxy)); t1.Start(); t2.Start(); t1.AssertNoException(); t2.AssertNoException(); }