public void LoadPostSussessTest()
        {
            postServiceClientMock.Setup(x => x.Get(It.IsAny <string>())).Returns(() =>
            {
                var task = new Task <Post>(() => post);
                task.Start();
                task.Wait();
                return(task);
            });

            var viewModel = new PostDetailsViewModel(null,
                                                     postServiceClientMock.Object,
                                                     commentServiceClientMock.Object,
                                                     windowManagerMock.Object,
                                                     progressBarMock.Object,
                                                     null);

            viewModel.LoadPost();

            Assert.AreNotEqual(null, viewModel.Post);
            Assert.AreEqual(post.Id, viewModel.Post.Id);
            Assert.AreEqual(post.Title, viewModel.Post.Title);
            Assert.AreEqual(post.Body, viewModel.Post.Body);
            Assert.AreEqual(post.User.UserId, viewModel.Post.User.UserId);
        }
        public void LoadPostProgressBarCallsSuccessTest()
        {
            var viewModel = new PostDetailsViewModel(null,
                                                     postServiceClientMock.Object,
                                                     commentServiceClientMock.Object,
                                                     windowManagerMock.Object,
                                                     progressBarMock.Object,
                                                     null);

            viewModel.LoadPost();

            progressBarMock.Verify(x => x.Show(), Times.Exactly(1));
        }
        public void LoadPostThrowExceptionSuccessTest()
        {
            var viewModel = new PostDetailsViewModel(null,
                                                     postServiceClientMock.Object,
                                                     commentServiceClientMock.Object,
                                                     windowManagerMock.Object,
                                                     progressBarMock.Object,
                                                     null);

            postServiceClientMock.Setup(x => x.Get(It.IsAny <string>())).Throws(new ConnectionTimeoutException());

            viewModel.LoadPost();

            windowManagerMock.Verify(x => x.ShowDialog(It.IsAny <object>(), null, null), Times.Exactly(1));
        }