示例#1
0
        public void NullValueShouldThrowError()
        {
            // Arrange

            string    input     = null;
            CheckFile checkFile = new CheckFile();

            // Act
            checkFile.ExtractTitle(input);
        }
示例#2
0
        public void ValidInputTextExtractsValidTitle()
        {
            //Arrange
            string    inputText = "Titel: C# Programmeren";
            string    expected  = " C# Programmeren";
            CheckFile checkFile = new CheckFile();

            //Act
            string actual = checkFile.ExtractTitle(inputText);

            // Assert
            Assert.IsTrue(string.Equals(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);
            }
        }