Beispiel #1
0
        public void QuizzFactory_GenerateQuizz_RetourneRightLevelQuizz(Level lvl)
        {
            // Arrange
            var levelProvider = Mock.Of <ILevelProvider>();

            Mock.Get(levelProvider).Setup(m => m.GetLevel()).Returns(lvl);

            var quizz = new QuizzFactory(levelProvider);

            // Act
            var newQuizz = quizz.GenerateQuizz(15);

            // Assert
            Assert.AreEqual(lvl, newQuizz.AverageLevel);
        }
Beispiel #2
0
        public void QuizzFactory_GenerateEasyQuizz_RetourneEasyLevel()
        {
            // Arrange
            //1. Créer un objet de type ILevelProvider
            var levelProvider = Mock.Of <ILevelProvider>();

            //2. Lui donner le comportement et retour souhaité
            Mock.Get(levelProvider).Setup(m => m.GetLevel()).Returns(Level.Easy);

            var quizz = new QuizzFactory(levelProvider);

            // Act
            var newQuizz = quizz.GenerateQuizz(15);

            // Assert
            Assert.AreEqual(Level.Easy, newQuizz.AverageLevel);
        }