public void SetUp() { var windsorContainer = new WindsorContainer(); windsorContainer.Register(Component.For <IService>().ImplementedBy <Service>()); windsorContainer.Register(Component.For <CrudObject>()); windsorContainer.Register(Component.For(typeof(IObjectFactory <>)).ImplementedBy(typeof(ObjectFactory <>))); windsorContainer.Register(Component.For <ICrudObjectRepository>().ImplementedBy <CrudObjectRepository>()); windsorContainer.Register(Component.For <IWorkerClass>().ImplementedBy <WorkerClass>()); _instance = windsorContainer.Resolve <IWorkerClass>(); }
static void Main(string[] args) { List <IWorkerClass> workerClasses = new List <IWorkerClass>(); for (int i = 0; i < 5; i++) { workerClasses.Add(new WorkerClass("worker" + i.ToString())); } foreach (IWorkerClass wc in workerClasses) { IWorkerClass temp = wc; Thread workerThread = new Thread(() => temp.StartWhileLoop()); workerThread.Start(); } Thread checkerThread = new Thread(() => ThreadReader(workerClasses)); checkerThread.Start(); Console.ReadKey(); }