public async Task GetSurveyAnswerBrowsingContextGetTheAnswersListBlob() { var mockSurveyAnswerIdsListContainer = new Mock <IAzureBlobContainer <List <string> > >(); var store = new SurveyAnswerStore( new Mock <ITenantStore>().Object, new Mock <ISurveyAnswerContainerFactory>().Object, new Mock <IAzureQueue <SurveyAnswerStoredMessage> >().Object, new Mock <IAzureQueue <SurveyAnswerStoredMessage> >().Object, mockSurveyAnswerIdsListContainer.Object); await store.GetSurveyAnswerBrowsingContextAsync("tenant", "slug-name", string.Empty); mockSurveyAnswerIdsListContainer.Verify(c => c.GetAsync("tenant-slug-name"), Times.Once()); }
public async Task GetSurveyAnswerBrowsingContextReturnsNullNextIdAndPreviousIdWhenListDoesNotExist() { var mockSurveyAnswerIdsListContainer = new Mock <IAzureBlobContainer <List <string> > >(); var store = new SurveyAnswerStore( new Mock <ITenantStore>().Object, new Mock <ISurveyAnswerContainerFactory>().Object, new Mock <IAzureQueue <SurveyAnswerStoredMessage> >().Object, new Mock <IAzureQueue <SurveyAnswerStoredMessage> >().Object, mockSurveyAnswerIdsListContainer.Object); mockSurveyAnswerIdsListContainer.Setup(c => c.GetAsync("tenant-slug-name")) .ReturnsAsync(default(List <string>)); var surveyAnswerBrowsingContext = await store.GetSurveyAnswerBrowsingContextAsync("tenant", "slug-name", "id"); Assert.IsNull(surveyAnswerBrowsingContext.PreviousId); Assert.IsNull(surveyAnswerBrowsingContext.NextId); }
public async Task GetSurveyAnswerBrowsingContextReturnsNextId() { var mockSurveyAnswerIdsListContainer = new Mock <IAzureBlobContainer <List <string> > >(); var store = new SurveyAnswerStore( new Mock <ITenantStore>().Object, new Mock <ISurveyAnswerContainerFactory>().Object, new Mock <IAzureQueue <SurveyAnswerStoredMessage> >().Object, new Mock <IAzureQueue <SurveyAnswerStoredMessage> >().Object, mockSurveyAnswerIdsListContainer.Object); mockSurveyAnswerIdsListContainer.Setup(c => c.GetAsync("tenant-slug-name")) .ReturnsAsync(new List <string> { "id 1", "id 2", "id 3" }); var surveyAnswerBrowsingContext = await store.GetSurveyAnswerBrowsingContextAsync("tenant", "slug-name", "id 2"); Assert.AreEqual("id 3", surveyAnswerBrowsingContext.NextId); }