public void TestProbeResolver_ResolvedTestProbe_ReturnsCorrectProbe()
        {
            //arrange
            TestProbeResolver sut = CreateTestProbeResolver();

            //act
            TestProbe result = sut.ResolvedTestProbe(TestActor, ChildName);

            //assert
            result.Should().BeSameAs(ResolvedTestProbe);
        }
        public void TestProbeResolver_ResolvedTestProbeWithNullParentActorAndChildName_ThrowsArgumentNullException()
        {
            //arrange
            TestProbeResolver sut = CreateTestProbeResolver();

            //act
            Action act = () => sut.ResolvedTestProbe(null, null);

            //assert
            act.ShouldThrow <ArgumentNullException>();
        }
        public void ParentActor_Constructor_SendsChildCorrectMessage()
        {
            //arrange
            TestProbeResolver resolver = TestProbeResolverSettings
                                         .Empty
                                         .CreateResolver(this);

            //act
            TestActorRef <ParentActor> sut = resolver.CreateSut <ParentActor>(2);

            //assert
            resolver
            .ResolvedTestProbe(sut, "child-actor-1")
            .ExpectMsg("hello actor 1");
        }
Example #4
0
        public void TestProbeResolver_ThrownsWhenChildHasNotBeenResolved()
        {
            //arrange
            TestProbeResolver sut = TestProbeResolverSettings
                                    .Empty
                                    .CreateResolver(this);

            //act
            TestActorRef <ParentActor> actor = sut.CreateSut <ParentActor>(Props.Create(() => new ParentActor()), 0);

            sut.TellMessage(actor, new CreateChild(Guid.NewGuid().ToString(), typeof(EchoActor)), 1);
            Action act = () => sut.ResolvedTestProbe(actor, Guid.NewGuid().ToString());

            //assert
            act.ShouldThrow <ActorNotFoundException>();
        }
Example #5
0
        public void TestProbeResolver_ResolvedTestProbesAreStored()
        {
            //arrange
            Type              childType = typeof(BlackHoleActor);
            string            childName = Guid.NewGuid().ToString();
            Guid              message   = Guid.NewGuid();
            TestProbeResolver sut       = TestProbeResolverSettings
                                          .Empty
                                          .CreateResolver(this);

            //act
            TestActorRef <ParentActor> actor = sut.CreateSut <ParentActor>(Props.Create(() => new ParentActor()), 0);

            sut.TellMessage(actor, new CreateChild(childName, childType), 1);
            TestProbe result = sut.ResolvedTestProbe(actor, childName);

            //assert
            actor.Tell(new TellChild(childName, message));
            result.ExpectMsg(message);
        }