예제 #1
0
        public FormStart(string domainName)
        {
            InitializeComponent();
            _domainName           = domainName;
            domainNameButton.Text = domainName;
            quizz          = new ConcreteQuizzFactory();
            _correctAnswer = showQuizz(i);

            //trebuie sa trecem la urmatoarea intrebare
            i++;
        }
예제 #2
0
        public void QuizzFactory_GenerateBasicQuizz_RetourneListeDeQuestions(int nb)
        {
            // Arrange
            var quizz = new QuizzFactory();

            // Act
            var questions = quizz.GenerateBasicQuizz(nb);

            // Assert
            Assert.AreEqual(nb, questions.Count());
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
0
        public FormStart(string domainName)
        {
            InitializeComponent();
            _domainName           = domainName;
            domainNameButton.Text = domainName;

            try
            {
                quizz          = new ConcreteQuizzFactory();
                _correctAnswer = showQuizz(i);
            }
            catch (OutOfMemoryException)
            {
                Console.WriteLine(" Error at create ConcreteQuizzFactory");
            }

            //trebuie sa trecem la urmatoarea intrebare
            i++;
        }