Esempio n. 1
0
        public List <StoryTellingForImpactQuiz> ReadStoryTellingForImpactQuiz(ExcelWorksheet worksheet, string action)
        {
            List <StoryTellingForImpactQuiz> storyTellingForImpactQuizzes = new List <StoryTellingForImpactQuiz>();
            var id = 1;

            for (var rowNumber = 2; rowNumber <= worksheet.Dimension.End.Row; rowNumber++)
            {
                var row = worksheet.Cells[rowNumber, 1, rowNumber, worksheet.Dimension.End.Column];
                StoryTellingForImpactQuiz question = new StoryTellingForImpactQuiz {
                    options = new Optionss()
                };

                var columnNumber = 0;
                foreach (var cell in row)
                {
                    switch (columnNumber)
                    {
                    case 0:
                        question.question = cell.Text;
                        break;

                    case 1:
                        question.statement = cell.Text;
                        break;

                    case 2:
                        question.type = cell.Text;
                        break;

                    case 3:
                        question.options.a = cell.Text;
                        break;

                    case 4:
                        question.options.b = cell.Text;
                        break;

                    case 5:
                        question.options.c = cell.Text;
                        break;

                    case 6:
                        question.options.d = cell.Text;
                        break;
                    }

                    columnNumber++;
                }

                question.id = id;
                question.updatetimestamp = DateTime.Now.ToString(CultureInfo.InvariantCulture);
                storyTellingForImpactQuizzes.Add(question);
                id++;
            }

            return(storyTellingForImpactQuizzes);
        }
Esempio n. 2
0
        public void StoryTellingForImpactController_saveStoryTellingQuiz()
        {
            //Act
            var actual = new StoryTellingForImpactController(_storyTellingForImpactBusinessLogic.Object);
            var storyTellingForImpactQuiz = new StoryTellingForImpactQuiz();

            var target = actual.saveStoryTellingQuiz(storyTellingForImpactQuiz);

            //Assert
            Assert.IsNotNull(target);
            Assert.AreEqual(200, ((ObjectResult)target).StatusCode);
        }
Esempio n. 3
0
        public void InsertStoryTellingForImpactQuizzesTest()
        {
            var request             = new StoryTellingForImpactQuiz();
            var getLatestIdResponse = new StoryTellingForImpactQuizAttempts();

            _mokstoryTellingForImpactQuiz.Setup(a => a.InsertOne(It.IsAny <StoryTellingForImpactQuiz>(), It.IsAny <string>()));

            _storyTellingForImpactQuizAdapter = new StoryTellingForImpactAdapter(_mokstoryTellingForImpactQuiz.Object, _settings.Object, _mokstoryTellingForImpactQuizAttempt.Object);

            var result = _storyTellingForImpactQuizAdapter.InsertStoryTellingForImpactQuizzes(request);

            _mokstoryTellingForImpactQuiz.Verify(a => a.InsertOne(It.IsAny <StoryTellingForImpactQuiz>(), It.IsAny <string>()));
        }
Esempio n. 4
0
 public int InsertStoryTellingForImpactQuizzes(StoryTellingForImpactQuiz storyTellingForImpactQuiz)
 {
     return(_storyTellingForImpactAdapter.InsertStoryTellingForImpactQuizzes(storyTellingForImpactQuiz));
 }
 public int InsertStoryTellingForImpactQuizzes(StoryTellingForImpactQuiz storyTellingForImpactQuiz)
 {
     _storyTellingForImpactQuiz.InsertOne(storyTellingForImpactQuiz, _storyTellingForImpactQuizCollection);
     return(1);
 }
 public IActionResult saveStoryTellingQuiz([FromBody] StoryTellingForImpactQuiz storyTellingForImpactQuiz)
 {
     return(Ok(_storyTellingForImpactBusinessLogic.InsertStoryTellingForImpactQuizzes(storyTellingForImpactQuiz)));
 }