Пример #1
0
        public void 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);

            store.GetSurveyAnswerBrowsingContext("tenant", "slug-name", string.Empty);

            mockSurveyAnswerIdsListContainer.Verify(c => c.Get("tenant-slug-name"), Times.Once());
        }
Пример #2
0
        public void 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.Get("tenant-slug-name"))
            .Returns(default(List <string>));

            var surveyAnswerBrowsingContext = store.GetSurveyAnswerBrowsingContext("tenant", "slug-name", "id");

            Assert.IsNull(surveyAnswerBrowsingContext.PreviousId);
            Assert.IsNull(surveyAnswerBrowsingContext.NextId);
        }
Пример #3
0
        public void GetSurveyAnswerBrowsingContextReturnsNullPreviousIdWhenInBeginingOfList()
        {
            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.Get("tenant-slug-name"))
            .Returns(new List <string> {
                "id 1"
            });

            var surveyAnswerBrowsingContext = store.GetSurveyAnswerBrowsingContext("tenant", "slug-name", "id 1");

            Assert.IsNull(surveyAnswerBrowsingContext.PreviousId);
        }
Пример #4
0
        public void 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.Get("tenant-slug-name"))
            .Returns(new List <string> {
                "id 1", "id 2", "id 3"
            });

            var surveyAnswerBrowsingContext = store.GetSurveyAnswerBrowsingContext("tenant", "slug-name", "id 2");

            Assert.AreEqual("id 3", surveyAnswerBrowsingContext.NextId);
        }
        public void GetSurveyAnswerBrowsingContextReturnsPreviousId()
        {
            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.Get("tenant-slug-name"))
                                            .Returns(new List<string> { "id 1", "id 2", "id 3" });

            var surveyAnswerBrowsingContext = store.GetSurveyAnswerBrowsingContext("tenant", "slug-name", "id 2");

            Assert.AreEqual("id 1", surveyAnswerBrowsingContext.PreviousId);
        }
        public void GetSurveyAnswerBrowsingContextReturnsNullNextIdWhenEndOfList()
        {
            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.Get("tenant-slug-name"))
                                            .Returns(new List<string> { "id 1" });

            var surveyAnswerBrowsingContext = store.GetSurveyAnswerBrowsingContext("tenant", "slug-name", "id 1");

            Assert.IsNull(surveyAnswerBrowsingContext.NextId);
        }
        public void 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);

            store.GetSurveyAnswerBrowsingContext("tenant", "slug-name", string.Empty);

            mockSurveyAnswerIdsListContainer.Verify(c => c.Get("tenant-slug-name"), Times.Once());
        }