mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
switched to xunit
This commit is contained in:
@@ -2,7 +2,7 @@ using LocalModels;
|
||||
|
||||
public class AssignmentMarkdownTests
|
||||
{
|
||||
[Test]
|
||||
[Fact]
|
||||
public void TestCanParseAssignmentSettings()
|
||||
{
|
||||
var assignment = new LocalAssignment()
|
||||
@@ -24,7 +24,7 @@ public class AssignmentMarkdownTests
|
||||
var parsedAssignment = LocalAssignment.ParseMarkdown(assignmentMarkdown);
|
||||
parsedAssignment.Should().BeEquivalentTo(assignment);
|
||||
}
|
||||
[Test]
|
||||
[Fact]
|
||||
public void AssignmentWithEmptyRubric_CanBeParsed()
|
||||
{
|
||||
var assignment = new LocalAssignment()
|
||||
@@ -43,7 +43,7 @@ public class AssignmentMarkdownTests
|
||||
var parsedAssignment = LocalAssignment.ParseMarkdown(assignmentMarkdown);
|
||||
parsedAssignment.Should().BeEquivalentTo(assignment);
|
||||
}
|
||||
[Test]
|
||||
[Fact]
|
||||
public void AssignmentWithEmptySubmissionTypes_CanBeParsed()
|
||||
{
|
||||
var assignment = new LocalAssignment()
|
||||
@@ -66,7 +66,7 @@ public class AssignmentMarkdownTests
|
||||
parsedAssignment.Should().BeEquivalentTo(assignment);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void AssignmentWithoutLockAtDate_CanBeParsed()
|
||||
{
|
||||
var assignment = new LocalAssignment()
|
||||
@@ -89,7 +89,7 @@ public class AssignmentMarkdownTests
|
||||
parsedAssignment.Should().BeEquivalentTo(assignment);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void AssignmentWithoutDescription_CanBeParsed()
|
||||
{
|
||||
var assignment = new LocalAssignment()
|
||||
@@ -111,7 +111,7 @@ public class AssignmentMarkdownTests
|
||||
var parsedAssignment = LocalAssignment.ParseMarkdown(assignmentMarkdown);
|
||||
parsedAssignment.Should().BeEquivalentTo(assignment);
|
||||
}
|
||||
[Test]
|
||||
[Fact]
|
||||
public void Assignments_CanHaveThreeDashes()
|
||||
{
|
||||
var assignment = new LocalAssignment()
|
||||
|
||||
@@ -5,14 +5,13 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework.Internal;
|
||||
|
||||
public class FileStorageTests
|
||||
{
|
||||
private IFileStorageManager fileManager { get; set; }
|
||||
private FileStorageManager fileManager { get; set; }
|
||||
|
||||
|
||||
private static string setupTempDirectory()
|
||||
public FileStorageTests()
|
||||
{
|
||||
var tempDirectory = Path.GetTempPath();
|
||||
var storageDirectory = tempDirectory + "fileStorageTests";
|
||||
@@ -29,14 +28,6 @@ public class FileStorageTests
|
||||
dir.Delete(true);
|
||||
}
|
||||
|
||||
return storageDirectory;
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
var storageDirectory = setupTempDirectory();
|
||||
|
||||
var fileManagerLogger = new MyLogger<FileStorageManager>(NullLogger<FileStorageManager>.Instance);
|
||||
var markdownLoaderLogger = new MyLogger<CourseMarkdownLoader>(NullLogger<CourseMarkdownLoader>.Instance);
|
||||
var markdownSaverLogger = new MyLogger<MarkdownCourseSaver>(NullLogger<MarkdownCourseSaver>.Instance);
|
||||
@@ -52,7 +43,7 @@ public class FileStorageTests
|
||||
fileManager = new FileStorageManager(fileManagerLogger, markdownLoader, markdownSaver, otherLogger, fileConfiguration);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public async Task EmptyCourse_CanBeSavedAndLoaded()
|
||||
{
|
||||
LocalCourse testCourse = new LocalCourse
|
||||
@@ -69,7 +60,7 @@ public class FileStorageTests
|
||||
loadedCourse.Should().BeEquivalentTo(testCourse);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public async Task CourseSettings_CanBeSavedAndLoaded()
|
||||
{
|
||||
LocalCourse testCourse = new()
|
||||
@@ -95,7 +86,7 @@ public class FileStorageTests
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public async Task EmptyCourseModules_CanBeSavedAndLoaded()
|
||||
{
|
||||
LocalCourse testCourse = new()
|
||||
@@ -119,7 +110,7 @@ public class FileStorageTests
|
||||
loadedCourse.Modules.Should().BeEquivalentTo(testCourse.Modules);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public async Task CourseModules_WithAssignments_CanBeSavedAndLoaded()
|
||||
{
|
||||
LocalCourse testCourse = new()
|
||||
@@ -160,7 +151,7 @@ public class FileStorageTests
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public async Task CourseModules_WithQuizzes_CanBeSavedAndLoaded()
|
||||
{
|
||||
LocalCourse testCourse = new()
|
||||
@@ -204,7 +195,7 @@ public class FileStorageTests
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public async Task MarkdownStorage_FullyPopulated_DoesNotLoseData()
|
||||
{
|
||||
LocalCourse testCourse = new()
|
||||
@@ -271,7 +262,7 @@ public class FileStorageTests
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public async Task MarkdownStorage_CanPersistPages()
|
||||
{
|
||||
LocalCourse testCourse = new()
|
||||
|
||||
@@ -2,7 +2,7 @@ using LocalModels;
|
||||
|
||||
public class PageMarkdownTests
|
||||
{
|
||||
[Test]
|
||||
[Fact]
|
||||
public void TestCanParsePage()
|
||||
{
|
||||
var page = new LocalCoursePage
|
||||
|
||||
@@ -2,7 +2,7 @@ using LocalModels;
|
||||
|
||||
public class MatchingTests
|
||||
{
|
||||
[Test]
|
||||
[Fact]
|
||||
public void CanParseMatchingQuestion()
|
||||
{
|
||||
var rawMarkdownQuiz = @"
|
||||
@@ -29,7 +29,7 @@ Match the following terms & definitions
|
||||
firstQuestion.Answers.First().MatchedText.Should().Be("a single command to be executed");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void CanCreateMarkdownForMatchingQuesiton()
|
||||
{
|
||||
var rawMarkdownQuiz = @"
|
||||
@@ -59,7 +59,7 @@ Match the following terms & definitions
|
||||
^ keyword - reserved word that has special meaning in a program (e.g. class, void, static, etc.)";
|
||||
questionMarkdown.Should().Contain(expectedMarkdown);
|
||||
}
|
||||
[Test]
|
||||
[Fact]
|
||||
public void WhitespaceIsOptional()
|
||||
{
|
||||
var rawMarkdownQuiz = @"
|
||||
|
||||
@@ -3,7 +3,7 @@ using LocalModels;
|
||||
public class MultipleAnswersTests
|
||||
{
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void QuzMarkdownIncludesMultipleAnswerQuestion()
|
||||
{
|
||||
var quiz = new LocalQuiz()
|
||||
@@ -43,7 +43,7 @@ oneline question
|
||||
markdown.Should().Contain(expectedQuestionString);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void CanParseQuestionWithMultipleAnswers()
|
||||
{
|
||||
var rawMarkdownQuiz = @"
|
||||
@@ -81,7 +81,7 @@ Which events are triggered when the user clicks on an input field?
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void CanUseBracesInAnswerFormultipleAnswer()
|
||||
{
|
||||
var rawMarkdownQuestion = @"
|
||||
@@ -95,7 +95,7 @@ Which events are triggered when the user clicks on an input field?
|
||||
question.Answers.Count().Should().Be(2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void CanUseBracesInAnswerFormultipleAnswer_MultiLine()
|
||||
{
|
||||
var rawMarkdownQuestion = @"
|
||||
|
||||
@@ -2,7 +2,7 @@ using LocalModels;
|
||||
|
||||
public class MultipleChoiceTests
|
||||
{
|
||||
[Test]
|
||||
[Fact]
|
||||
public void QuzMarkdownIncludesMultipleChoiceQuestion()
|
||||
{
|
||||
var quiz = new LocalQuiz()
|
||||
@@ -58,7 +58,7 @@ endline
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void LetterOptionalForMultipleChoice()
|
||||
{
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using LocalModels;
|
||||
public class QuizDeterministicChecks
|
||||
{
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void SerializationIsDeterministic_EmptyQuiz()
|
||||
{
|
||||
var quiz = new LocalQuiz()
|
||||
@@ -23,7 +23,7 @@ public class QuizDeterministicChecks
|
||||
parsedQuiz.Should().BeEquivalentTo(quiz);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void SerializationIsDeterministic_ShowCorrectAnswers()
|
||||
{
|
||||
var quiz = new LocalQuiz()
|
||||
@@ -43,7 +43,7 @@ public class QuizDeterministicChecks
|
||||
parsedQuiz.Should().BeEquivalentTo(quiz);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void SerializationIsDeterministic_ShortAnswer()
|
||||
{
|
||||
var quiz = new LocalQuiz()
|
||||
@@ -71,7 +71,7 @@ public class QuizDeterministicChecks
|
||||
parsedQuiz.Should().BeEquivalentTo(quiz);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void SerializationIsDeterministic_Essay()
|
||||
{
|
||||
var quiz = new LocalQuiz()
|
||||
@@ -99,7 +99,7 @@ public class QuizDeterministicChecks
|
||||
parsedQuiz.Should().BeEquivalentTo(quiz);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void SerializationIsDeterministic_MultipleAnswer()
|
||||
{
|
||||
var quiz = new LocalQuiz()
|
||||
@@ -138,7 +138,7 @@ public class QuizDeterministicChecks
|
||||
parsedQuiz.Should().BeEquivalentTo(quiz);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void SerializationIsDeterministic_MultipleChoice()
|
||||
{
|
||||
var quiz = new LocalQuiz()
|
||||
@@ -176,7 +176,7 @@ public class QuizDeterministicChecks
|
||||
var parsedQuiz = LocalQuiz.ParseMarkdown(quizMarkdown);
|
||||
parsedQuiz.Should().BeEquivalentTo(quiz);
|
||||
}
|
||||
[Test]
|
||||
[Fact]
|
||||
public void SerializationIsDeterministic_Matching()
|
||||
{
|
||||
var quiz = new LocalQuiz()
|
||||
|
||||
@@ -4,7 +4,7 @@ using LocalModels;
|
||||
// try to follow syntax from https://github.com/gpoore/text2qti
|
||||
public class QuizMarkdownTests
|
||||
{
|
||||
[Test]
|
||||
[Fact]
|
||||
public void CanSerializeQuizToMarkdown()
|
||||
{
|
||||
var quiz = new LocalQuiz()
|
||||
@@ -37,7 +37,7 @@ this is my description in markdown
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void TestCanParseMarkdownQuizWithNoQuestions()
|
||||
{
|
||||
var rawMarkdownQuiz = new StringBuilder();
|
||||
@@ -68,7 +68,7 @@ this is my description in markdown
|
||||
quiz.AllowedAttempts.Should().Be(-1);
|
||||
quiz.Description.Should().Be(expectedDescription.ToString());
|
||||
}
|
||||
[Test]
|
||||
[Fact]
|
||||
public void TestCanParseMarkdownQuizPassword()
|
||||
{
|
||||
|
||||
@@ -94,7 +94,7 @@ this is my description in markdown
|
||||
quiz.Password.Should().Be(password);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void TestCanParseMarkdownQuiz_CanConfigureToShowCorrectAnswers()
|
||||
{
|
||||
var rawMarkdownQuiz = new StringBuilder();
|
||||
@@ -118,7 +118,7 @@ this is my description in markdown
|
||||
quiz.showCorrectAnswers.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void TestCanParseQuizWithQuestions()
|
||||
{
|
||||
var rawMarkdownQuiz = @"
|
||||
@@ -159,7 +159,7 @@ b) false
|
||||
firstQuestion.Answers.ElementAt(1).Text.Should().Contain("endline");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void CanParseMultipleQuestions()
|
||||
{
|
||||
var rawMarkdownQuiz = @"
|
||||
@@ -192,7 +192,7 @@ b) false
|
||||
secondQuestion.QuestionType.Should().Be(QuestionType.MULTIPLE_CHOICE);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void ShortAnswerToMarkdown_IsCorrect()
|
||||
{
|
||||
var rawMarkdownQuiz = @"
|
||||
@@ -220,7 +220,7 @@ Which events are triggered when the user clicks on an input field?
|
||||
short_answer";
|
||||
questionMarkdown.Should().Contain(expectedMarkdown);
|
||||
}
|
||||
[Test]
|
||||
[Fact]
|
||||
public void NegativePoints_IsAllowed()
|
||||
{
|
||||
var rawMarkdownQuiz = @"
|
||||
@@ -244,7 +244,7 @@ short answer
|
||||
var firstQuestion = quiz.Questions.First();
|
||||
firstQuestion.Points.Should().Be(-4);
|
||||
}
|
||||
[Test]
|
||||
[Fact]
|
||||
public void FloatingPointPoints_IsAllowed()
|
||||
{
|
||||
var rawMarkdownQuiz = @"
|
||||
|
||||
@@ -2,7 +2,7 @@ using LocalModels;
|
||||
|
||||
public class TextAnswerTests
|
||||
{
|
||||
[Test]
|
||||
[Fact]
|
||||
public void CanParseEssay()
|
||||
{
|
||||
var rawMarkdownQuiz = @"
|
||||
@@ -28,7 +28,7 @@ essay
|
||||
firstQuestion.Text.Should().NotContain("essay");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void CanParseShortAnswer()
|
||||
{
|
||||
var rawMarkdownQuiz = @"
|
||||
@@ -54,7 +54,7 @@ short answer
|
||||
firstQuestion.Text.Should().NotContain("short answer");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void ShortAnswerToMarkdown_IsCorrect()
|
||||
{
|
||||
var rawMarkdownQuiz = @"
|
||||
@@ -83,7 +83,7 @@ short_answer";
|
||||
questionMarkdown.Should().Contain(expectedMarkdown);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void EssayQuestionToMarkdown_IsCorrect()
|
||||
{
|
||||
var rawMarkdownQuiz = @"
|
||||
|
||||
@@ -3,7 +3,7 @@ using LocalModels;
|
||||
public class RubricMarkdownTests
|
||||
{
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void TestCanParseOneItem()
|
||||
{
|
||||
var rawRubric = @"
|
||||
@@ -17,7 +17,7 @@ public class RubricMarkdownTests
|
||||
rubric.First().Points.Should().Be(2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void TestCanParseMultipleItems()
|
||||
{
|
||||
var rawRubric = @"
|
||||
@@ -32,7 +32,7 @@ public class RubricMarkdownTests
|
||||
rubric.ElementAt(1).Points.Should().Be(3);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void TestCanParseSinglePoint()
|
||||
{
|
||||
var rawRubric = @"
|
||||
@@ -45,7 +45,7 @@ public class RubricMarkdownTests
|
||||
rubric.First().Points.Should().Be(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void TestCanParseSingleExtraCredit_LowerCase()
|
||||
{
|
||||
var rawRubric = @"
|
||||
@@ -57,7 +57,7 @@ public class RubricMarkdownTests
|
||||
rubric.First().Label.Should().Be("(extra credit) this is the task");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void TestCanParseSingleExtraCredit_UpperCase()
|
||||
{
|
||||
var rawRubric = @"
|
||||
@@ -69,7 +69,7 @@ public class RubricMarkdownTests
|
||||
rubric.First().Label.Should().Be("(Extra Credit) this is the task");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Fact]
|
||||
public void TestCanParseFloatingPointNubmers()
|
||||
{
|
||||
var rawRubric = @"
|
||||
@@ -79,7 +79,7 @@ public class RubricMarkdownTests
|
||||
var rubric = LocalAssignment.ParseRubricMarkdown(rawRubric);
|
||||
rubric.First().Points.Should().Be(1.5);
|
||||
}
|
||||
[Test]
|
||||
[Fact]
|
||||
public void TestCanParseNegativeNubmers()
|
||||
{
|
||||
var rawRubric = @"
|
||||
@@ -89,7 +89,7 @@ public class RubricMarkdownTests
|
||||
var rubric = LocalAssignment.ParseRubricMarkdown(rawRubric);
|
||||
rubric.First().Points.Should().Be(-2.0);
|
||||
}
|
||||
[Test]
|
||||
[Fact]
|
||||
public void TestCanParseNegativeFloatingPointNubmers()
|
||||
{
|
||||
var rawRubric = @"
|
||||
|
||||
Reference in New Issue
Block a user