public async Task It_produces_failed_notifications_when_a_section_navigates()
        {
            var sut       = new BlindSectionsNavigator("defaultSection1", "defaultSection2");
            var eventList = new List <(object sender, SectionsNavigatorEventArgs args)>();

            var section = await sut.SetActiveSection(CancellationToken.None, SectionsNavigatorRequest.GetSetActiveSectionRequest("defaultSection1"));

            sut.StateChanged += OnStateChanged;
            void OnStateChanged(object sender, SectionsNavigatorEventArgs args)
            {
                eventList.Add((sender, args));
            }

            await Assert.ThrowsAsync <InvalidOperationException>(async() => await section.Navigate(CancellationToken.None, StackNavigatorRequest.GetNavigateRequest(() => TestVM.Throw(), suppressTransition: true)));

            Assert.Equal(2, eventList.Count);
            Assert.Equal(NavigatorRequestState.Processing, eventList[0].args.CurrentState.LastRequestState);
            Assert.Equal(SectionsNavigatorRequestType.ReportSectionStateChanged, eventList[0].args.CurrentState.LastRequest.RequestType);
            Assert.Equal(NavigatorRequestState.FailedToProcess, eventList[1].args.CurrentState.LastRequestState);
            Assert.Equal(SectionsNavigatorRequestType.ReportSectionStateChanged, eventList[1].args.CurrentState.LastRequest.RequestType);
        }
        public async Task It_produces_failed_notifications_for_OpenModal()
        {
            var sut       = new BlindSectionsNavigator();
            var eventList = new List <(object sender, SectionsNavigatorEventArgs args)>();

            sut.StateChanged += OnStateChanged;
            void OnStateChanged(object sender, SectionsNavigatorEventArgs args)
            {
                eventList.Add((sender, args));
            }

            await Assert.ThrowsAsync <InvalidOperationException>(async() => await sut.OpenModal(CancellationToken.None, SectionsNavigatorRequest.GetOpenModalRequest(StackNavigatorRequest.GetNavigateRequest(() => TestVM.Throw(), suppressTransition: true))));

            sut.StateChanged -= OnStateChanged;

            Assert.Equal(2, eventList.Count);
            Assert.Equal(NavigatorRequestState.Processing, eventList[0].args.CurrentState.LastRequestState);
            Assert.Equal(SectionsNavigatorRequestType.OpenModal, eventList[0].args.CurrentState.LastRequest.RequestType);

            Assert.Equal(NavigatorRequestState.FailedToProcess, eventList[1].args.CurrentState.LastRequestState);
            Assert.Equal(SectionsNavigatorRequestType.OpenModal, eventList[1].args.CurrentState.LastRequest.RequestType);
        }
        public async Task It_produces_failed_notifications_for_Navigate()
        {
            var sut = new BlindStackNavigator();

            var events = new List <StackNavigatorEventArgs>();

            sut.StateChanged += Sut_StateChanged;

            void Sut_StateChanged(object sender, StackNavigatorEventArgs args)
            {
                events.Add(args);
            }

            await Assert.ThrowsAsync <InvalidOperationException>(async() => await sut.Navigate(CancellationToken.None, StackNavigatorRequest.GetNavigateRequest(() => TestVM.Throw())));

            sut.StateChanged -= Sut_StateChanged;

            // There must be 2 notifications: 1 Processing when the navigation starts and 1 FailedToProcess when it ends.
            Assert.Equal(2, events.Count);
            Assert.Equal(NavigatorRequestState.Processing, events[0].CurrentState.LastRequestState);
            Assert.Equal(NavigatorRequestState.FailedToProcess, events[1].CurrentState.LastRequestState);
        }