public async Task GetInitialState_CurrentFlowIsSecondFlow_ThrowsException()
        {
            //Arrange
            var initialStateContext = new InitialStateContext(
                Substitute.For <IMediator>(),
                Substitute.For <IProvisioningStateFactory>());

            var nextStateContext = new NextStateContext(
                Substitute.For <IMediator>(),
                Substitute.For <IProvisioningStateFactory>(),
                Substitute.For <IProvisioningState>());

            var fakeProvisioningStateFlow1 = Substitute.For <IProvisioningStateFlow>();

            fakeProvisioningStateFlow1
            .GetNextStateAsync(nextStateContext)
            .Returns((IProvisioningState)null);

            var fakeProvisioningStateFlow2 = Substitute.For <IProvisioningStateFlow>();

            var flow = new AggregateProvisioningStateFlow(
                fakeProvisioningStateFlow1,
                fakeProvisioningStateFlow2);

            await flow.GetNextStateAsync(nextStateContext);

            //Act
            var exception = await Assert.ThrowsExceptionAsync <InvalidOperationException>(async() =>
                                                                                          await flow.GetInitialStateAsync(initialStateContext));

            //Assert
            Assert.IsNotNull(exception);
        }
        public async Task GetInitialState_CurrentFlowIsFirstFlow_ReturnsInitialStateOfFirstFlow()
        {
            //Arrange
            var context = new InitialStateContext(
                Substitute.For <IMediator>(),
                Substitute.For <IProvisioningStateFactory>());

            var fakeProvisioningStateFlow = Substitute.For <IProvisioningStateFlow>();

            var fakeInitialState = await fakeProvisioningStateFlow.GetInitialStateAsync(context);

            var flow = new AggregateProvisioningStateFlow(fakeProvisioningStateFlow);

            //Act
            var initialState = await flow.GetInitialStateAsync(context);

            //Assert
            Assert.AreSame(fakeInitialState, initialState);
        }