public void ShouldThrowExceptionWhenNotDateNotFormatted() { //Arrange string inputText = "Startdatum: testing"; // Geen datum CheckFile checkFile = new CheckFile(); //Act & Assert checkFile.ExtractStartDatum(inputText); }
public void NullValueShouldThrowError() { // Arrange string input = null; CheckFile checkFile = new CheckFile(); // Act checkFile.ExtractStartDatum(input); }
public void ShouldThrowExceptionWhenNotDateButFormatted() { //Arrange string inputText = "Startdatum: 15/13/2018"; // 13e maand CheckFile checkFile = new CheckFile(); //Act & Assert checkFile.ExtractStartDatum(inputText); }
public void ValidInputTextExtractsValidCode() { //Arrange string inputText = "Startdatum: 15/10/2018"; DateTime expected = new DateTime(2018, 10, 15); CheckFile checkFile = new CheckFile(); //Act DateTime actual = checkFile.ExtractStartDatum(inputText); // Assert Assert.IsTrue(actual == expected); }
private async Task CheckParagraph(string paragraph) { CheckFile cf = new CheckFile(); string[] line = paragraph.Split("\n"); //check of Cursus al bestaat if (!_context.cursussen.Any(e => e.CursusCode.Equals(cf.ExtractCode(line[1])))) { Cursus cursus = new Cursus(cf.ExtractTitle(line[0]), cf.ExtractCode(line[1]), cf.ExtractDuur(line[2])); await addCursus(cursus); } else { int id = _context.cursussen.SingleOrDefault(c => c.CursusCode == cf.ExtractCode(line[1])).Id; DateTime startDatum = cf.ExtractStartDatum(line[3]); Cursusinstantie cursusinstantie = new Cursusinstantie(id, startDatum); await addCursusInstantie(cursusinstantie); } }