public ActorRuntimeMock(IMessageSerializer serializer = null) { System = new ActorSystemMock(serializer); Timers = new TimerServiceMock(); Reminders = new ReminderServiceMock(); Activation = new ActivationServiceMock(); }
public void Regex_based_matching(string source, string target, string streamId, string actorId) { var system = new ActorSystemMock(); var attribute = new StreamSubscriptionAttribute { Source = source, Target = target }; var type = typeof(TestActor); var dispatcher = new Dispatcher(type); var specification = StreamSubscriptionSpecification.From(type, attribute, dispatcher); specification.Type = ActorTypeName.Of(typeof(TestActor)); var match = specification.Match(system, streamId); if (match == StreamSubscriptionMatch.None) { Assert.That(actorId, Is.Null); return; } var message = new object(); match.Receiver(message); Assert.That(system.RequestedRef, Is.Not.Null); Assert.That(system.RequestedRef.Path, Is.EqualTo(typeof(TestActor).ToActorPath(actorId))); Assert.That(system.RequestedRef.MessagePassedToTell, Is.SameAs(message)); }
public virtual void SetUp() { System = new ActorSystemMock(); Timers = new TimerServiceMock(); Reminders = new ReminderServiceMock(); Observers = new ObserverCollectionMock(); }
public void Regex_based_matching(string source, string target, string streamId, string actorId) { var system = new ActorSystemMock(); var attribute = new StreamSubscriptionAttribute { Source = source, Target = target }; var type = ActorType.From(typeof(TestActor)); var specification = StreamSubscriptionSpecification.From(type, attribute); var match = specification.Match(system, streamId); if (match == StreamSubscriptionMatch.None) { Assert.That(actorId, Is.Null); return; } var message = new object(); match.Receiver(message); Assert.That(system.RequestedRef, Is.Not.Null); Assert.That(system.RequestedRef.Path, Is.EqualTo(ActorPath.From(typeof(TestActor), actorId))); Assert.That(system.RequestedRef.MessagePassedToTell, Is.SameAs(message)); }
public void Dynamic_target_matching() { var system = new ActorSystemMock(); var type = ActorType.From(typeof(DynamicTargetSelectorActor)); var specification = StreamSubscriptionSpecification.From(type).ElementAt(0); var match = specification.Match(system, "foo"); var message = new object(); match.Receiver(message); Assert.That(system.RequestedRef, Is.Not.Null); Assert.That(system.RequestedRef.Path, Is.EqualTo(ActorPath.From(typeof(DynamicTargetSelectorActor), "bar"))); Assert.That(system.RequestedRef.MessagePassedToTell, Is.SameAs(message)); }
public void SetUpTest() { system = new ActorSystemMock(); }