예제 #1
0
        public ICompletes <T> ActorOf <T>(Address address)
        {
            var actor = directory.ActorOf(address);

            if (actor != null)
            {
                return(Completes <T>().With <T>(Stage.ActorAs <T>(actor)));
            }

            return(Completes <T>().With <T>(default(T)));
        }
예제 #2
0
        public void TestDirectoryFindsRegistered()
        {
            var directory = new Directory(new BasicAddress(0, ""));
            var address1  = World.AddressFactory.UniqueWith("test-actor1");
            var address2  = World.AddressFactory.UniqueWith("test-actor2");
            var address3  = World.AddressFactory.UniqueWith("test-actor3");
            var address4  = World.AddressFactory.UniqueWith("test-actor4");
            var address5  = World.AddressFactory.UniqueWith("test-actor5");

            directory.Register(address1, new TestInterfaceActor());
            directory.Register(address2, new TestInterfaceActor());
            directory.Register(address3, new TestInterfaceActor());
            directory.Register(address4, new TestInterfaceActor());
            directory.Register(address5, new TestInterfaceActor());

            Assert.NotNull(directory.ActorOf(address1));
            Assert.NotNull(directory.ActorOf(address2));
            Assert.NotNull(directory.ActorOf(address3));
            Assert.NotNull(directory.ActorOf(address4));
            Assert.NotNull(directory.ActorOf(address5));
            Assert.Null(directory.ActorOf(World.AddressFactory.UniqueWith("test-actor6")));
        }