mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
quizzes and assignments support negative and floating point values
This commit is contained in:
@@ -220,4 +220,52 @@ Which events are triggered when the user clicks on an input field?
|
||||
short_answer";
|
||||
questionMarkdown.Should().Contain(expectedMarkdown);
|
||||
}
|
||||
[Test]
|
||||
public void NegativePoints_IsAllowed()
|
||||
{
|
||||
var rawMarkdownQuiz = @"
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 2023-08-21T23:59:00
|
||||
LockAt: 2023-08-21T23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
multi line
|
||||
description
|
||||
---
|
||||
Points: -4
|
||||
Which events are triggered when the user clicks on an input field?
|
||||
short answer
|
||||
";
|
||||
|
||||
var quiz = LocalQuiz.ParseMarkdown(rawMarkdownQuiz);
|
||||
var firstQuestion = quiz.Questions.First();
|
||||
firstQuestion.Points.Should().Be(-4);
|
||||
}
|
||||
[Test]
|
||||
public void FloatingPointPoints_IsAllowed()
|
||||
{
|
||||
var rawMarkdownQuiz = @"
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 2023-08-21T23:59:00
|
||||
LockAt: 2023-08-21T23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
multi line
|
||||
description
|
||||
---
|
||||
Points: 4.56
|
||||
Which events are triggered when the user clicks on an input field?
|
||||
short answer
|
||||
";
|
||||
|
||||
var quiz = LocalQuiz.ParseMarkdown(rawMarkdownQuiz);
|
||||
var firstQuestion = quiz.Questions.First();
|
||||
firstQuestion.Points.Should().Be(4.56);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,4 +68,35 @@ public class RubricMarkdownTests
|
||||
rubric.First().IsExtraCredit.Should().BeTrue();
|
||||
rubric.First().Label.Should().Be("(Extra Credit) this is the task");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCanParseFloatingPointNubmers()
|
||||
{
|
||||
var rawRubric = @"
|
||||
- 1.5pt: this is the task
|
||||
";
|
||||
|
||||
var rubric = LocalAssignment.ParseRubricMarkdown(rawRubric);
|
||||
rubric.First().Points.Should().Be(1.5);
|
||||
}
|
||||
[Test]
|
||||
public void TestCanParseNegativeNubmers()
|
||||
{
|
||||
var rawRubric = @"
|
||||
- -2pt: this is the task
|
||||
";
|
||||
|
||||
var rubric = LocalAssignment.ParseRubricMarkdown(rawRubric);
|
||||
rubric.First().Points.Should().Be(-2.0);
|
||||
}
|
||||
[Test]
|
||||
public void TestCanParseNegativeFloatingPointNubmers()
|
||||
{
|
||||
var rawRubric = @"
|
||||
- -2895.00053pt: this is the task
|
||||
";
|
||||
|
||||
var rubric = LocalAssignment.ParseRubricMarkdown(rawRubric);
|
||||
rubric.First().Points.Should().Be(-2895.00053);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user