示例#1
0
            public static void SetupGeneratorActors(Random random, int locationNameLength = 5)
            {
                if (random == null)
                {
                    throw new ArgumentNullException(nameof(random));
                }
                RandomIntActorRef    = ActorSystem.ActorOf(RandomIntActor.CreateProps(random), RandomIntActor.Name);
                RandomDoubleActorRef = ActorSystem.ActorOf(RandomDoubleActor.CreateProps(random), RandomDoubleActor.Name);

                LocationNameGeneratorActorRef = ActorSystem.ActorOf(LocationNameGeneratorActor.CreateProps(RandomIntActorRef, locationNameLength), LocationNameGeneratorActor.Name);
            }
        public void Setup()
        {
            var logger = new LoggerConfiguration()
                         .WriteTo.LiterateConsole()
                         .MinimumLevel.Debug()
                         .CreateLogger();

            Serilog.Log.Logger = logger;

            var config = "akka { loglevel=DEBUG,  loggers=[\"Akka.Logger.Serilog.SerilogLogger, Akka.Logger.Serilog\"]}";

            _testkit = new TestKit(config, "testSystem");
            var random = new System.Random();

            _random            = _testkit.Sys.ActorOf(RandomIntActor.CreateProps(random), "random");
            _locationGenerator = _testkit.Sys.ActorOf(LocationNameGeneratorActor.CreateProps(_random, 6),
                                                      LocationNameGeneratorActor.Name);
        }