Exemplo n.º 1
0
        public async void ShouldGetQuestionnaireViewModel()
        {
            //Arrange
            var expectedTitle = "My expected quesitons";
            Mock <IGetApiClient> mockGetApiClient = new Mock <IGetApiClient>();
            var questionnaire = new QuestionnaireViewModel
            {
                QuestionnaireTitle = expectedTitle
            };

            mockGetApiClient.Setup(m => m.Get <QuestionnaireViewModel>(It.IsAny <string>()))
            .ReturnsAsync(questionnaire);

            var questionnaireService = new Questionnaire(mockGetApiClient.Object);

            //Act
            var result = (QuestionnaireViewModel)await questionnaireService.GetAsync();

            //Assert
            Assert.That(result.QuestionnaireTitle, Is.EqualTo(expectedTitle));
        }