Exemplo n.º 1
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);
        }