예제 #1
0
        public void TestDefaultValues()
        {
            var eval = new Evaluation();

            Assert.IsNull(eval.Definition);
            Assert.IsNull(eval.Value);

            Assert.IsNull(eval.Name);
            Assert.IsNull(eval.MaxPoints);
            Assert.IsNull(eval.MinPoints);
            Assert.IsNull(eval.Points);
            Assert.IsNull(eval.ValidPoints);
            Assert.IsNull(eval.Reason);

            Assert.IsTrue(eval.HasResultPassed);
            Assert.IsFalse(eval.HasResultFailed);
        }
예제 #2
0
        public void TestEvaluationDefinition()
        {
            var eval = new Evaluation()
            {
                Definition =  new EvaluationDefinition(),
            };

            Assert.IsNull(eval.Value);

            Assert.IsNull(eval.Name);
            Assert.IsNull(eval.MaxPoints);
            Assert.IsNull(eval.MinPoints);
            Assert.IsNull(eval.Points);
            Assert.IsNull(eval.ValidPoints);
            Assert.IsNull(eval.Reason);

            Assert.IsTrue(eval.HasResultPassed);
            Assert.IsFalse(eval.HasResultFailed);

            const string name = "Category";

            eval.Definition.Name = name;
            Assert.AreEqual(eval.Definition.Name, name);
            Assert.AreEqual(eval.Definition.Name, eval.Name);

            decimal? minValue = 5m;
            eval.Definition.MinPoints = minValue;
            Assert.AreEqual(eval.Definition.MinPoints, minValue);
            Assert.AreEqual(eval.Definition.MinPoints, eval.MinPoints);

            decimal? maxValue = 10m;
            eval.Definition.MaxPoints = maxValue;
            Assert.AreEqual(eval.Definition.MaxPoints, maxValue);
            Assert.AreEqual(eval.Definition.MaxPoints, eval.MaxPoints);

            //check, if all other things are unmodified
            Assert.IsNull(eval.Points);
            Assert.IsNull(eval.ValidPoints);
            Assert.IsNull(eval.Reason);

            Assert.IsFalse(eval.HasResultPassed);
            Assert.IsTrue(eval.HasResultFailed);
        }
예제 #3
0
        public void TestEvaluationToStringMethod()
        {
            //empty
            var eval = new Evaluation();
            Assert.AreEqual(eval.ToString(), "<?>: ?b");

            eval.Definition = new EvaluationDefinition()
            {
                Name = "Category",
            };

            Assert.AreEqual(eval.ToString(), "Category: ?b");

            eval.Value = new EvaluationValue()
            {
                Points = 5,
            };

            Assert.AreEqual(eval.ToString(), "Category: 5b");
        }