예제 #1
0
        public void SutSupervisorStrategyGetter_GetWithActorWithDefaultSupervisorStrategy_ReturnsCorrectSupervisorStrategy()
        {
            //arrange
            SutSupervisorStrategyGetter sut = CreateSutSupervisorStrategyGetter();

            //act
            SupervisorStrategy result = sut.Get(ActorWithDefaultSupervisorStrategy);

            //assert
            result.Should().BeSameAs(SupervisorStrategy.DefaultStrategy);
        }
예제 #2
0
        public void SutSupervisorStrategyGetter_GetWithNullActor_ThrowsArgumentNullException()
        {
            //arrange
            SutSupervisorStrategyGetter sut = CreateSutSupervisorStrategyGetter();

            //act
            Action act = () => sut.Get(null);

            //assert
            act.ShouldThrow <ArgumentNullException>();
        }
예제 #3
0
        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;
            };
        }