public async Task GetSurveysForUser_ReturnsSurveys()
        {
            _surveyStore.Setup(s => s.GetPublishedSurveysByOwnerAsync(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>()))
            .ReturnsAsync(new List <Survey>());
            _surveyStore.Setup(s => s.GetSurveysByOwnerAsync(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>()))
            .ReturnsAsync(new List <Survey>());
            _surveyStore.Setup(s => s.GetSurveysByContributorAsync(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>()))
            .ReturnsAsync(new List <Survey>());

            _target.ControllerContext = CreateActionContextWithUserPrincipal("12345", "testTenantId");
            var result = await _target.GetSurveysForUser(12345);

            var objectResult = (ObjectResult)result;

            Assert.IsType <UserSurveysDTO>(objectResult.Value);
        }
예제 #2
0
        public async Task GetSurveysForUser_ReturnsSurveys()
        {
            ICollection <Survey> surveys = new List <Survey>();

            A.CallTo(() => _surveyStore.GetPublishedSurveysByOwnerAsync(A <int> .Ignored, A <int> .Ignored, A <int> .Ignored))
            .Returns(Task.FromResult(surveys));
            A.CallTo(() => _surveyStore.GetSurveysByOwnerAsync(A <int> .Ignored, A <int> .Ignored, A <int> .Ignored))
            .Returns(Task.FromResult(surveys));
            A.CallTo(() => _surveyStore.GetSurveysByContributorAsync(A <int> .Ignored, A <int> .Ignored, A <int> .Ignored))
            .Returns(Task.FromResult(surveys));

            _target.ControllerContext = CreateActionContextWithUserPrincipal("12345", "testTenantId");
            var result = await _target.GetSurveysForUser(12345);

            var objectResult = (ObjectResult)result;

            Assert.IsType <UserSurveysDTO>(objectResult.Value);
        }