Ejemplo n.º 1
0
        public void Start()
        {
            int logicalProcs = Environment.ProcessorCount;

            for (int i = 0; i < logicalProcs; i++)
            {
                string name = String.Format("T{0}", i + 1);
                _runtime.CreateThread(name);
            }

            Console.WriteLine("Created {0} runtime threads.", logicalProcs);

            var folderReader = new HttpActors.FolderReader();
            int readerId     = _runtime.AddActor(folderReader);

            var manager = new HttpActors.PumpManager();

            manager.MaxPumps     = MaxPumps;
            manager.Folder       = _folder;
            manager.FolderReader = readerId;

            int managerId = _runtime.AddActor(manager);

            Console.WriteLine("Starting web server at port {0} and folder '{1}'...", _port, _folder);
            _listener.Start();
            Console.WriteLine("Server started.");

            RunServer(_listener, managerId, _runtime, _source.Token);
        }
Ejemplo n.º 2
0
        public void SendCall_SendResult_Completed()
        {
            Callee callee = new Callee {
                Result = CallResult.Completed
            };
            int    target = _runtime.AddActor(callee);
            Caller caller = new Caller {
                History = _history, Finished = _finishTest, Target = target
            };
            int callerId = _runtime.AddActor(caller);

            _runtime.SendMessage(callerId, Start, null, 0);
            _finishTest.WaitOne();

            CollectionAssert.AreEquivalent(
                new string[] { "Completed 2 hi" },
                _history
                );
        }