示例#1
0
        public void CreateQuiz()
        {
            // Arrange
            var id   = 100;
            var quiz = GetFakeQuiz.Entity(id);

            // Act
            var result = _service.CreateQuiz(quiz);

            // Assert
            Assert.IsTrue(result.IsOK);
            var insertedQuiz = _service.GetQuiz(id).GetData();

            Assert.IsNotNull(insertedQuiz);
            Assert.AreEqual(insertedQuiz.Id, id);
            Assert.AreEqual(insertedQuiz.Name, "Name" + id);
        }
示例#2
0
        public void Create()
        {
            // Arrange
            var id   = 888;
            var item = GetFakeQuiz.Entity(id);

            // Act
            var result = repository.CreateItem(item);

            // Assert
            Assert.IsTrue(result);
            var insertedItem = repository.GetItem(id);

            Assert.IsTrue(insertedItem.Id == id);
            Assert.IsTrue(insertedItem.Name == "Name" + id);
            var items = repository.GetAllItems();

            Assert.IsTrue(items.Count() == ITEMS_COUNT + 1);
        }
示例#3
0
        public MockQuizRepository()
        {
            _context = new List <Quiz>();

            for (int i = 0; i < 5; i++)
            {
                var quiz = GetFakeQuiz.Entity(i + 1);

                if ((i + 1) % 2 == 0)
                {
                    quiz.TeacherId = 1;
                }
                else
                {
                    quiz.TeacherId = 2;
                }

                quiz.QuizQuestions.Add(GetFakeQuiz.FullQuestion((i + 1)));
                quiz.QuizQuestions.Add(GetFakeQuiz.FullQuestion((i + 1)));
                _context.Add(quiz);
            }
        }