Пример #1
0
        public TestBase() : base(AkkaConfig.Config)
        {
            Func <Type> generateType = TestUtils.RandomTypeGenerator();

            // Create mocks
            TestProbeCreatorMock = new Mock <ITestProbeCreator>();

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

            // Create objects passed into sut methods
            TestProbeCreatorPassedIntoSut = TestProbeCreatorMock.Object;
            TestKitPassedIntoSut          = this;
            HandlersPassedIntoSut         = ImmutableDictionary <Type, Func <object, object> >
                                            .Empty
                                            .Add(generateType(), mess => TestUtils.Create <object>());

            //Set up shims
            ShimTestProbeActor.ConstructorITestProbeCreatorTestKitBaseIReadOnlyDictionaryOfTypeFuncOfObjectObject =
                (@this, testProbeCreator, testKit, handlers) =>
            {
                ShimConstructorCallCount++;
                TestProbeCreatorPassedIntoShim = testProbeCreator;
                TestKitPassedIntoShim          = testKit;
                HandlersPassedIntoShim         = handlers;
                TestProbeActorReturnedByShim   = @this;
            };
        }
Пример #2
0
        public void TestProbeActor_Actor_ReturnsSameResultOnEveryCall()
        {
            //arrange
            TestProbeActor sut = CreateTestProbeActorWithoutSupervisorStrategy().UnderlyingActor;

            //act
            ActorBase result = sut.Actor;

            //assert
            result.Should().BeSameAs(sut.Actor);
        }
Пример #3
0
        public void TestProbeActor_ActorPath__ReturnsSameResultOnEveryCall()
        {
            //arrange
            TestProbeActor sut = CreateTestProbeActor().UnderlyingActor;

            //act
            Akka.Actor.ActorPath result = sut.ActorPath;

            //assert
            result.Should().BeSameAs(sut.ActorPath);
        }
Пример #4
0
        public void TestProbeActor_Actror_ReturnsActor()
        {
            //arrange
            TestProbeActor sut = CreateTestProbeActor().UnderlyingActor;

            //act
            ActorBase result = sut.Actor;

            //assert
            result.Should().BeSameAs(sut);
        }
        public void TestProbeActor_TestProbe_ReturnsSameResultOnEveryCall()
        {
            //arrange
            TestProbeActor sut = CreateTestProbeActor().UnderlyingActor;

            //act
            Akka.TestKit.TestProbe result = sut.TestProbe;

            //assert
            result.Should().BeSameAs(sut.TestProbe);
        }
Пример #6
0
        public void TestProbeActorWithSupervisorStrategy_PropsSupervisorStrategy__ReturnsSameResultOnEveryCall()
        {
            //arrange
            AllForOneStrategy exptected = new AllForOneStrategy(
                TestUtils.Create <int>(),
                TestUtils.Create <int>(),
                exception => TestUtils.Create <Directive>());
            TestProbeActor sut = CreateTestProbeActorWithSupervisorStrategy(exptected).UnderlyingActor;

            //act
            SupervisorStrategy result = sut.PropsSupervisorStrategy;

            //assert
            result.Should().BeSameAs(exptected);
        }