Пример #1
0
        public void GetFirstSurveyAnswerIdGetTheAnswersListBlob()
        {
            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.GetFirstSurveyAnswerId("tenant", "slug-name");

            mockSurveyAnswerIdsListContainer.Verify(c => c.Get("tenant-slug-name"), Times.Once());
        }
Пример #2
0
        public void GetFirstSurveyAnswerIdReturnsEmprtyStringWhenListIsEmpty()
        {
            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 id = store.GetFirstSurveyAnswerId("tenant", "slug-name");

            Assert.AreEqual(string.Empty, id);
        }
Пример #3
0
        public void GetFirstSurveyAnswerIdReturnsTheAnswerWhichAppearsFirstOnTheListWhenListIsNotEmpty()
        {
            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"
            });

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

            Assert.AreEqual("id", id);
        }
        public void GetFirstSurveyAnswerIdReturnsTheAnswerWhichAppearsFirstOnTheListWhenListIsNotEmpty()
        {
            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" });

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

            Assert.AreEqual("id", id);
        }
        public void GetFirstSurveyAnswerIdReturnsEmprtyStringWhenListIsEmpty()
        {
            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 id = store.GetFirstSurveyAnswerId("tenant", "slug-name");

            Assert.AreEqual(string.Empty, id);
        }
        public void GetFirstSurveyAnswerIdGetTheAnswersListBlob()
        {
            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.GetFirstSurveyAnswerId("tenant", "slug-name");

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