public async Task ListSurveysReturnsSlugName() { var surveyInformationRow = new SurveyInformationRow { SlugName = "slug" }; var surveyRowsToReturn = new[] { surveyInformationRow }; var mock = new Mock <IAzureTable <SurveyInformationRow> >(); mock.Setup(t => t.GetByPartitionKeyAsync(It.IsAny <string>())).ReturnsAsync(surveyRowsToReturn); var mockSurveyInformationTable = new Mock <IAzureTable <SurveyInformationRow> >(); var target = new SurveyManagementService(null, (tableName) => mock.Object, null); var actualSurveys = await target.ListSurveysAsync(); Assert.AreEqual("slug", actualSurveys.First().SlugName); }
public async Task GetSurveyList() { var objId = Guid.NewGuid().ToString(); var questions = new List <Question>(); questions.Add(new Question { Text = "q1", Type = QuestionType.SimpleText }); //Publish 20 Surveys for (int i = 0; i < 20; i++) { await target.PublishSurveyAsync(new Survey { Title = $"test {i} {objId}", Questions = questions }); } var surveys = await target.ListSurveysAsync(); Assert.IsTrue(surveys.Count > 0); }