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 GetRecentSurveysReturnsTitle() { var surveyInformationRow = new SurveyInformationRow { Title = "title" }; var surveyRowsToReturn = new[] { surveyInformationRow }; var mock = new Mock <IAzureTable <SurveyInformationRow> >(); mock.Setup(t => t.GetLatestAsync(10)).ReturnsAsync(surveyRowsToReturn); var mockSurveyInformationTable = new Mock <IAzureTable <SurveyInformationRow> >(); var target = new SurveyManagementService(null, (tableName) => mock.Object, null); var actualSurveys = await target.GetLatestSurveysAsync(); Assert.AreEqual("title", actualSurveys.First().Title); }