示例#1
0
        public void GettingScreens_WhenThereIsATweet_ContainsAScreen()
        {
            var mockScreen = Substitute.For<ITweetScreen>();

            var test = new TimelineScreen(new Lazy<ITimeline>(() => _timeline), x => mockScreen);
            test.Initialize();

            _tweets.Add(A.Tweet.Build());

            test.Screens.Should().Contain.Item(mockScreen);
            mockScreen.Received().Initialize();
        }
        public void GettingScreens_WhenThereIsATweet_ContainsAScreen()
        {
            var mockScreen = new Mock<ILoadingTweetScreen>();

            var test = new TimelineScreen(_fakeTimeline.Object, x => mockScreen.Object);
            test.Initialize();

            _tweets.Add("5");

            Assert.Contains(mockScreen.Object, test.Screens);
            mockScreen.Verify(x => x.Initialize());
        }
示例#3
0
        public void SettingSelection_WhenATweetWasSelected_MarksTweetAsRead()
        {
            var mockScreen = Substitute.For<ITweetScreen>();
            var mockCommand = Substitute.For<ICommand>();
            bool commandExecuted = false;

            mockScreen.MarkAsReadCommand.Returns(mockCommand);

            mockCommand.When(x => x.Execute(null)).Do(_ => commandExecuted = true);

            var test = new TimelineScreen(new Lazy<ITimeline>(() => _timeline), x => mockScreen);
            test.Initialize();

            _tweets.Add(A.Tweet.Build());

            test.Selection = mockScreen;
            test.Selection = null;

            Wait.Until(() => commandExecuted);
        }