Ejemplo n.º 1
0
        public void DeleteSurveyAnswersCreatesBlobContainer()
        {
            var mockSurveyContainerFactory = new Mock <ISurveyAnswerContainerFactory>();
            var store = new SurveyAnswerStore(
                new Mock <ITenantStore>().Object,
                mockSurveyContainerFactory.Object,
                new Mock <IAzureQueue <SurveyAnswerStoredMessage> >().Object,
                new Mock <IAzureQueue <SurveyAnswerStoredMessage> >().Object,
                new Mock <IAzureBlobContainer <List <string> > >().Object);

            mockSurveyContainerFactory.Setup(f => f.Create(It.IsAny <string>(), It.IsAny <string>()))
            .Returns(new Mock <IAzureBlobContainer <SurveyAnswer> >().Object);

            store.DeleteSurveyAnswers("tenant", "slug-name");

            mockSurveyContainerFactory.Verify(f => f.Create("tenant", "slug-name"), Times.Once());
        }
        public void DeleteSurveyAnswersCallsDeleteFromBlobContainer()
        {
            var mockSurveyAnswerBlobContainer = new Mock<IAzureBlobContainer<SurveyAnswer>>();
            var mockSurveyContainerFactory = new Mock<ISurveyAnswerContainerFactory>();
            var store = new SurveyAnswerStore(
                new Mock<ITenantStore>().Object,
                mockSurveyContainerFactory.Object,
                new Mock<IAzureQueue<SurveyAnswerStoredMessage>>().Object,
                new Mock<IAzureQueue<SurveyAnswerStoredMessage>>().Object,
                new Mock<IAzureBlobContainer<List<string>>>().Object);

            mockSurveyContainerFactory.Setup(f => f.Create(It.IsAny<string>(), It.IsAny<string>()))
                                      .Returns(mockSurveyAnswerBlobContainer.Object);

            store.DeleteSurveyAnswers("tenant", "slug-name");

            mockSurveyAnswerBlobContainer.Verify(c => c.DeleteContainer(), Times.Once());
        }