public void ConcreteResolver_TellMessageNoSenderWithNullRecipientAndMessageAndSender_ThrowsArgumentNullException() { //arrange ConcreteResolver sut = CreateConcreteResolver(ImmutableDictionary <Type, Func <ActorBase> > .Empty); //act Action act = () => sut.TellMessage <object>(null, null, null, ExpectedChildrenCount); //assert act.ShouldThrow <ArgumentNullException>(); }
public void ConcreteResolver_TellMessageSender_TellsChild() { //arrange ConcreteResolver sut = CreateConcreteResolver(ImmutableDictionary <Type, Func <ActorBase> > .Empty); //act sut.TellMessage(Recipient, Message, Sender, ExpectedChildrenCount); //assert ChildTellerMock.Verify( teller => teller.TellMessage(ChildWaiterMock.Object, this, Recipient, Message, ExpectedChildrenCount, Sender), Times.Once); }
public void ConcreteResolver_TimesoutWhenWaitingForChildrenWithAnExpectedChildCountThatIsTooHigh() { //arrange const int initialChildCount = 2; const int moreChildCount = 5; ConcreteResolver sut = ConcreteResolverSettings .Empty .Register <EmptyChildActor>() .Register <ChildActor>() .CreateResolver(this); TestActorRef <ParentActor> actor = sut.CreateSut <ParentActor>(Props.Create(() => new ParentActor(initialChildCount)), initialChildCount); //act Action act = () => sut.TellMessage(actor, moreChildCount, moreChildCount + 1); //assert act.ShouldThrow <TimeoutException>(); }
public void ConcreteResolver_WaitsForChildrenCreatedWhenProcessingMessages() { //arrange const int initialChildCount = 2; const int moreChildCount = 5; ConcreteResolver sut = ConcreteResolverSettings .Empty .Register <EmptyChildActor>() .Register <ChildActor>() .CreateResolver(this); TestActorRef <ParentActor> actor = sut.CreateSut <ParentActor>(Props.Create(() => new ParentActor(initialChildCount)), initialChildCount); //act sut.TellMessage(actor, moreChildCount, moreChildCount); //assert actor.Tell(new object()); ExpectMsgAllOf(Enumerable.Repeat(ChildActor.Token, initialChildCount + moreChildCount).ToArray()); }