Esempio n. 1
0
        public void TestProbeDependencyResolverAdder_AddWithAllNulls_ThrowsArgumentNullException()
        {
            //arrange
            TestProbeDependencyResolverAdder sut = CreateTestProbeDependencyResolverAdder();

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

            //assert
            act.ShouldThrow <ArgumentNullException>();
        }
Esempio n. 2
0
        public void TestProbeDependencyResolverAdder_AddWithNullChildWaiter_ThrowsArgumentNullException()
        {
            //arrange
            TestProbeDependencyResolverAdder sut = CreateTestProbeDependencyResolverAdder();

            //act
            Action act = () => sut.Add(
                DependencyResolverAdder,
                TestProbeActorCreator,
                TestProbeCreator,
                ResolvedTestProbeStore,
                null,
                this,
                Handlers);

            //assert
            act.ShouldThrow <ArgumentNullException>();
        }
Esempio n. 3
0
        public void TestProbeDependencyResolverAdder_Add_AddedFactoryReturnsActorWhenCalledWithoutHandlers()
        {
            //arrange
            TestProbeDependencyResolverAdder sut = CreateTestProbeDependencyResolverAdder();

            //act
            sut.Add(
                DependencyResolverAdder,
                TestProbeActorCreator,
                TestProbeCreator,
                ResolvedTestProbeStore,
                ChildWaiter,
                this,
                Handlers);

            //assert
            ActorBase result = ActorFactory(ActorWithoutHandlersType);

            result.Should().BeSameAs(ResolvedActorWithoutHandlers);
        }
Esempio n. 4
0
        public void TestProbeDependencyResolverAdder_Add_AddedFactoryStoresChildInStoreBeforeResolvingInWaiterWhenCalledWithoutHandlers()
        {
            //arrange
            TestProbeDependencyResolverAdder sut = CreateTestProbeDependencyResolverAdder();

            //act
            sut.Add(
                DependencyResolverAdder,
                TestProbeActorCreator,
                TestProbeCreator,
                ResolvedTestProbeStore,
                ChildWaiter,
                this,
                Handlers);

            //assert
            ActorFactory(ActorWithoutHandlersType);
            CallOrder.Should().Equal(
                nameof(IResolvedTestProbeStore.ResolveProbe),
                nameof(IChildWaiter.ResolvedChild));
        }
Esempio n. 5
0
        public void TestProbeDependencyResolverAdder_Add_AddedFactoryResolvesChildWaiterWhenCalledWithoutHandlers()
        {
            //arrange
            TestProbeDependencyResolverAdder sut = CreateTestProbeDependencyResolverAdder();

            //act
            sut.Add(
                DependencyResolverAdder,
                TestProbeActorCreator,
                TestProbeCreator,
                ResolvedTestProbeStore,
                ChildWaiter,
                this,
                Handlers);

            //assert
            ActorFactory(ActorWithoutHandlersType);
            ChildWaiterMock.Verify(
                waiter => waiter.ResolvedChild(),
                Times.Once);
        }
Esempio n. 6
0
        public void TestProbeDependencyResolverAdder_Add_AddedFactoryStoresTestProbeActorWhenCalledWithoutHandlers()
        {
            //arrange
            TestProbeDependencyResolverAdder sut = CreateTestProbeDependencyResolverAdder();

            //act
            sut.Add(
                DependencyResolverAdder,
                TestProbeActorCreator,
                TestProbeCreator,
                ResolvedTestProbeStore,
                ChildWaiter,
                this,
                Handlers);

            //assert
            ActorFactory(ActorWithoutHandlersType);
            ResolvedTestProbeStoreMock.Verify(
                store => store.ResolveProbe(
                    ResolvedActorPathWithoutHandlers,
                    ActorWithoutHandlersType,
                    ResolvedTestProbeWithoutHandlers,
                    ResolvedSupervisorStrategyWithoutHandlers));
        }
        public TestBase() : base(AkkaConfig.Config)
        {
            // Create values passed into sut
            TestKitPassedIntoSut  = this;
            HandlersPassedIntoSut = ImmutableDictionary <(Type, Type), Func <object, object> >
                                    .Empty
                                    .Add((typeof(DummyActor1), typeof(Message1)), message1 => new Reply1())
                                    .Add((typeof(DummyActor1), typeof(Message2)), message1 => new Reply2())
                                    .Add((typeof(DummyActor2), typeof(Message1)), message1 => new Reply1());

            PropsPassedIntoSut      = Props.Create <DummyActor1>();
            NumberOfChildrenIntoSut = TestUtils.Create <int>();

            // Create shims
            _shimContext = ShimsContext.Create();

            // Set up shims
            ShimSutCreator.Constructor = @this =>
            {
                SutCreatorConstructorCount++;
                ConstructedSutCreator = @this;
            };

            ShimTellChildWaiter.Constructor = @this =>
            {
                TellChildWaiterConstructorCount++;
                ConstructedTellChildWaiter = @this;
            };

            ShimChildWaiter.Constructor = @this =>
            {
                ChildWaiterConstructorCount++;
                ConstructedChildWaiter = @this;
            };

            ShimDependencyResolverAdder.Constructor = @this =>
            {
                DependencyResolverAdderConstructorCount++;
                ConstructedDependencyResolverAdder = @this;
            };

            ShimTestProbeDependencyResolverAdder.Constructor = @this =>
            {
                TestProbeDependencyResolverAdderConstructorCount++;
                ConstructedTestProbeDependencyResolverAdder = @this;
            };

            ShimTestProbeCreator.Constructor = @this =>
            {
                TestProbeCreatorConstructorCount++;
                ConstructedTestProbeCreator = @this;
            };

            ShimResolvedTestProbeStore.Constructor = @this =>
            {
                ResolvedTestProbeStoreConstructorCount++;
                ConstructedResolvedTestProbeStore = @this;
            };

            ShimTestProbeActorCreator.Constructor = @this =>
            {
                TestProbeActorCreatorConstructorCount++;
                ConstructedTestProbeActorCreator = @this;
            };

            ShimTestProbeHandlersMapper.Constructor = @this =>
            {
                TestProbeHandlersMapperConstructorCount++;
                ConstructedTestProbeHandlersMapper = @this;
            };

            ShimSutSupervisorStrategyGetter.Constructor = @this =>
            {
                SutSupervisorStrategyGetterConstructorCount++;
                ConstructedSutSupervisorStrategyGetter = @this;
            };

            ShimUnitTestFramework <DummyActor1> .ConstructorISutCreatorITellChildWaiterIChildWaiterIDependencyResolverAdderITestProbeDependencyResolverAdderITestProbeCreatorIResolvedTestProbeStoreITestProbeActorCreatorITestProbeHandlersMapperISutSupervisorStrategyGetterImmutableDictionaryOfValueTupleOfTy =
                (@this, sutCreator, tellChildWaiter, childWaiter, dependencyResolverAdder, testProbeDependencyResolverAdder, testProbeCreator, resolvedTestProbeStore, testProbeActorCreator, testProbeHandlersMapper, sutSupervisorStrategyGetter, handlers, testKit, props, numberOfChildren) =>
            {
                UnitTestFrameworkConstructorCount++;
                ConstructedUnitTestFramework                   = @this;
                SutCreatorPassedIntoShim                       = sutCreator;
                TellChildWaiterPassedIntoShim                  = tellChildWaiter;
                ChildWaiterPassedIntoShim                      = childWaiter;
                DependencyResolverAdderPassedIntoShim          = dependencyResolverAdder;
                TestProbeDependencyResolverAdderPassedIntoShim = testProbeDependencyResolverAdder;
                TestProbeCreatorPassedIntoShim                 = testProbeCreator;
                ResolvedTestProbeStorePassedIntoShim           = resolvedTestProbeStore;
                TestProbeActorCreatorPassedIntoShim            = testProbeActorCreator;
                TestProbeHandlersMapperPassedIntoShim          = testProbeHandlersMapper;
                SutSupervisorStrategyGetterIntoShim            = sutSupervisorStrategyGetter;
                HandlersPassedIntoShim   = handlers;
                TestKitPassedIntoShim    = testKit;
                PropsPassedIntoShim      = props;
                NumberOfChildrenIntoShim = numberOfChildren;
            };
        }