示例#1
0
        public void IntConstructorSingleTableEvaluateReturnsTrueWhenAnswerIsCorrect()
        {
            // Arrange
            const int testMultiple = 5;
            var       engine       = new MultiplicationEngine(new[] { testMultiple });
            var       p            = engine.CreateRandomMultiplicationProblem();

            p.Answer = p.Multiple * p.Multiplier;

            // Act
            bool result = engine.Evaluate(p);

            // Assert
            Assert.IsTrue(p.IsAnswered);
            Assert.IsTrue(result);
        }
示例#2
0
        public void EnumConstructorSingleTableEvaluateReturnsFalseWhenAnswerIsNotCorrect()
        {
            // Arrange
            const MultiplicationTable testMultiple = MultiplicationTable.Five;
            var engine = new MultiplicationEngine(new[] { testMultiple });
            var p      = engine.CreateRandomMultiplicationProblem();

            p.Answer = 33; // just a number that is not a multiple of testMultiple

            // Act
            bool result = engine.Evaluate(p);

            // Assert
            Assert.IsTrue(p.IsAnswered);
            Assert.IsFalse(result);
        }