public void UnitTestFramework_TellMessageAndWaitForExceptionsNoSenderWithNullMessage_ThrowsArgumentNullException()
        {
            //arrange
            UnitTestFramework <DummyActor> sut = CreateUnitTestFramework();

            //act
            Action act = () => sut.TellMessageAndWaitForExceptions <object>(
                null,
                ExpectedExceptionCount);

            //assert
            act.Should().Throw <ArgumentNullException>();
        }
Example #2
0
        public void UnitTestFramework_TimesOutWhenWaitingForExceptionsWithAnExpectedChildCountThatIsTooHigh()
        {
            //arrange
            const int initialChildCount = 0;
            const int exceptionCount    = 2;
            Exception exception1        = new ArithmeticException();
            Exception exception2        = new InvalidCastException();

            UnitTestFramework <ThrowingParentActor> sut = UnitTestFrameworkSettings
                                                          .Empty
                                                          .CreateFramework <ThrowingParentActor>(this, Props.Create(() => new ThrowingParentActor(exception1, exception2)), initialChildCount);

            //act
            Action act = () => sut.TellMessageAndWaitForExceptions(new object(), exceptionCount + 1);

            //assert
            act.Should().Throw <TimeoutException>();
        }
Example #3
0
        public void UnitTestFramework_WaitsForExceptionsThrownWhenProcessingMessages()
        {
            //arrange
            const int initialChildCount = 0;
            const int exceptionCount    = 2;
            Exception exception1        = new ArithmeticException();
            Exception exception2        = new InvalidCastException();

            UnitTestFramework <ThrowingParentActor> sut = UnitTestFrameworkSettings
                                                          .Empty
                                                          .CreateFramework <ThrowingParentActor>(this, Props.Create(() => new ThrowingParentActor(exception1, exception2)), initialChildCount);

            //act
            sut.TellMessageAndWaitForExceptions(new object(), exceptionCount);

            //assert
            sut.UnhandledExceptions.Should().Equal(exception1, exception2);
        }
        public void UnitTestFramework_TellMessageAndWaitForExceptions_InvokesTellWaiter()
        {
            //arrange
            UnitTestFramework <DummyActor> sut = CreateUnitTestFramework();

            //act
            sut.TellMessageAndWaitForExceptions(Message, ExpectedChildCount);

            //assert
            TellWaiterMock.Verify(
                teller => teller.TellMessage(
                    ExceptionWaiter,
                    this,
                    SutActor,
                    Message,
                    ExpectedChildCount,
                    null),
                Times.Once);
        }