示例#1
0
        public void GetPointsPerGrade_RatingSchemeObjectCorrectlyInitialized_ReceivedValuesMatchExpectedValues()
        {
            // Arrange
            IRatingScheme ratingScheme = new RatingScheme(4, new List <int>()
            {
                10, 20, 30, 40
            });
            Dictionary <double, double[]> pointsPerGrade = new Dictionary <double, double[]>();

            for (int i = 0; i < 3; i++)
            {
                pointsPerGrade.Add(i + 1, new double[2]);
            }

            // Act
            pointsPerGrade = ratingScheme.Ratings.PointsPerGrade;

            // Assert
            Assert.IsTrue(
                pointsPerGrade.ElementAt(0).Value[0] == 0.0 &&
                pointsPerGrade.ElementAt(0).Value[1] == 39.5 &&
                pointsPerGrade.ElementAt(1).Value[0] == 40.0 &&
                pointsPerGrade.ElementAt(1).Value[1] == 49.5,
                "The received values match the expected values");
        }
示例#2
0
 public void CreatingRatingSchemeObject_RatingSchemeObjectWithNumberOfProblemsIs0_RatingSchemeExceptionIsThrown()
 {
     try
     {
         // Arrange
         // Act
         IRatingScheme ratingScheme = new RatingScheme(0, new List <int>());
     }
     catch (Exception ex)
     {
         // Assert
         Assert.IsTrue(
             ex is RatingSchemeException,
             $"The thrown Exception is a {nameof(RatingSchemeException)}, when the numberOfProblems is 0.");
     }
 }
示例#3
0
        public void GetRaitingsForExam_RaitingSchemeObjectIsCorrectlyInitialized_TheRaitingsPropertyContainsTheExpectedValues()
        {
            // Arrange
            IRatingScheme ratingScheme = new RatingScheme(3, new List <int>()
            {
                2, 1, 2
            });
            RatingSchemeDTO ratings = new RatingSchemeDTO();

            // Act
            ratings = ratingScheme.Ratings;

            // Assert
            Assert.IsTrue(
                ratings.MaximumPoints == 5 && ratings.NumberOfProblems == 3,
                "The RatingSchemeDTO contains the expected Values.");
        }
示例#4
0
 public void CreateRaitingSchemeObject_RatingSchemeObjectWithDifferentValuesForNumberOfProblemsAndCountOfPointsPerProblemList_RatingSchemeExceptionIsThrown()
 {
     try
     {
         // Arrange
         // Act
         IRatingScheme ratingScheme = new RatingScheme(3, new List <int>()
         {
             1, 2
         });
     }
     catch (Exception ex)
     {
         // Assert
         Assert.IsTrue(
             ex is RatingSchemeException,
             $"The thrown Exception is a {nameof(RatingSchemeException)}, when the numberOfProblems and Count of pointsPerProblem do not match.");
     }
 }