예제 #1
0
        public void RegisterStoryboards_Ok()
        {
            var service = new StoryboardsNavigationService();

            service.SetUiInvoker(new TestInvoker());
            service.RegisterStoryboard(_patientStoryboard);
            service.RegisterStoryboard(_sessionsStoryboard);
            service.RegisterStoryboard(_settingsStoryboard);
            Assert.True(true);
        }
예제 #2
0
        public void CreateStartPages_Ok()
        {
            var pageCreator = new Mock <IStoryboardPageCreator>();

            pageCreator
            .Setup(x => x.CreateView(It.IsAny <Type>()))
            .Returns(new TestView());
            pageCreator
            .Setup(x => x.CreateViewModel(It.IsAny <Type>()))
            .Returns(new TestViewModel());

            var service = new StoryboardsNavigationService();

            service.SetUiInvoker(new TestInvoker());
            service.SetStoryboardPageCreator(pageCreator.Object);
            service.RegisterStoryboard(_patientStoryboard);
            service.RegisterStoryboard(_sessionsStoryboard);
            service.RegisterStoryboard(_settingsStoryboard);
            service.CreateStartPages();
            Assert.True(true);
        }
예제 #3
0
        public async Task GoToStoryboard_Ok()
        {
            var pageCreator = new Mock <IStoryboardPageCreator>();

            pageCreator
            .Setup(x => x.CreateView(It.IsAny <Type>()))
            .Returns(new TestView());
            pageCreator
            .Setup(x => x.CreateViewModel(It.IsAny <Type>()))
            .Returns(new TestViewModel());

            var service = new StoryboardsNavigationService();

            service.SetUiInvoker(new TestInvoker());
            var currentStoryboardId = Guid.Empty;

            service.ActiveStoryboardChanged += (sender, guid) => currentStoryboardId = guid;

            service.SetStoryboardPageCreator(pageCreator.Object);
            service.RegisterStoryboard(_patientStoryboard);
            service.RegisterStoryboard(_sessionsStoryboard);
            service.RegisterStoryboard(_settingsStoryboard);
            service.CreateStartPages();

            await service.GoToStoryboardAsync(_patientStoryboard.StoryboardId);

            Assert.Equal(_patientStoryboard.StoryboardId, currentStoryboardId);

            await service.GoToStoryboardAsync(_sessionsStoryboard.StoryboardId);

            Assert.Equal(_sessionsStoryboard.StoryboardId, currentStoryboardId);

            await service.GoToStoryboardAsync(_settingsStoryboard.StoryboardId);

            Assert.Equal(_settingsStoryboard.StoryboardId, currentStoryboardId);

            await service.GoToStoryboardAsync(_patientStoryboard.StoryboardId);

            Assert.Equal(_patientStoryboard.StoryboardId, currentStoryboardId);
        }
예제 #4
0
        public async Task GoBackOnDifferentStoryboards_Ok()
        {
            var pageCreator = new Mock <IStoryboardPageCreator>();

            pageCreator
            .SetupSequence(x => x.CreateView(It.IsAny <Type>()))
            .Returns(new TestView())
            .Returns(new TestView())
            .Returns(new TestView())
            .Returns(new TestView())
            .Returns(new TestView())
            .Returns(new TestView());
            pageCreator
            .SetupSequence(x => x.CreateViewModel(It.IsAny <Type>()))
            .Returns(new TestViewModel())
            .Returns(new TestViewModel())
            .Returns(new TestViewModel())
            .Returns(new TestViewModel())
            .Returns(new TestViewModel())
            .Returns(new TestViewModel());

            var service = new StoryboardsNavigationService();

            service.SetUiInvoker(new TestInvoker());
            var currentStoryboardId = Guid.Empty;

            service.ActiveStoryboardChanged += (sender, guid) => currentStoryboardId = guid;

            service.SetStoryboardPageCreator(pageCreator.Object);
            service.RegisterStoryboard(_patientStoryboard);
            service.RegisterStoryboard(_sessionsStoryboard);
            service.RegisterStoryboard(_settingsStoryboard);
            service.CreateStartPages();

            await service.GoToPageAsync(FirstPageId);

            Assert.Equal(_patientStoryboard.StoryboardId, currentStoryboardId);
            Assert.Equal(_patientStoryboard.ActivePage.ViewModel.PageId, FirstPageId);

            await service.GoToPageAsync(ForuthPageId);

            Assert.Equal(_patientStoryboard.StoryboardId, currentStoryboardId);
            Assert.Equal(_patientStoryboard.ActivePage.ViewModel.PageId, ForuthPageId);
            Assert.True(service.CanGoBack());


            await service.GoToPageAsync(SecondPageId);

            Assert.Equal(_sessionsStoryboard.StoryboardId, currentStoryboardId);
            Assert.Equal(_sessionsStoryboard.ActivePage.ViewModel.PageId, SecondPageId);


            await service.GoToPageAsync(SixthPageId);

            Assert.Equal(_sessionsStoryboard.StoryboardId, currentStoryboardId);
            Assert.Equal(_sessionsStoryboard.ActivePage.ViewModel.PageId, SixthPageId);

            await service.GoToPageAsync(ThirdPageId);

            Assert.Equal(_settingsStoryboard.StoryboardId, currentStoryboardId);
            Assert.Equal(_settingsStoryboard.ActivePage.ViewModel.PageId, ThirdPageId);


            await service.GoToPageAsync(FifthPageId);

            Assert.Equal(_patientStoryboard.StoryboardId, currentStoryboardId);
            Assert.Equal(_patientStoryboard.ActivePage.ViewModel.PageId, FifthPageId);

            Assert.True(service.CanGoBack());
            await service.GoBackAsync();

            Assert.Equal(_patientStoryboard.StoryboardId, currentStoryboardId);
            Assert.Equal(_patientStoryboard.ActivePage.ViewModel.PageId, ForuthPageId);

            Assert.True(service.CanGoBack());
            await service.GoBackAsync();

            Assert.Equal(_patientStoryboard.StoryboardId, currentStoryboardId);
            Assert.Equal(_patientStoryboard.ActivePage.ViewModel.PageId, FirstPageId);

            Assert.True(service.CanGoBack());
            await service.GoBackAsync();

            Assert.Equal(_settingsStoryboard.StoryboardId, currentStoryboardId);
            Assert.Equal(_settingsStoryboard.ActivePage.ViewModel.PageId, ThirdPageId);


            Assert.True(service.CanGoBack());
            await service.GoBackAsync();

            Assert.Equal(_sessionsStoryboard.StoryboardId, currentStoryboardId);
            Assert.Equal(_sessionsStoryboard.ActivePage.ViewModel.PageId, SixthPageId);

            Assert.True(service.CanGoBack());
            await service.GoBackAsync();

            Assert.Equal(_sessionsStoryboard.StoryboardId, currentStoryboardId);
            Assert.Equal(_sessionsStoryboard.ActivePage.ViewModel.PageId, SecondPageId);

            Assert.False(service.CanGoBack());
        }