Ejemplo n.º 1
0
        public void VindCursusLijstPerWeekFaalend()
        {
            using (var repo = new CursusRepositoryMock())
            {
                //Arrange

                var target = new CursusController(repo);

                //Act
                var result = target.GetByWeek("Faal maar");

                //Assert
                Assert.AreEqual(0, repo.TimesFindByCalled);
                Assert.IsInstanceOfType(result, typeof(BadRequestObjectResult));
            }
        }
Ejemplo n.º 2
0
        public void VindCursusLijstPerWeekFaalendErrorMessage()
        {
            using (var repo = new CursusRepositoryMock())
            {
                //Arrange

                var target = new CursusController(repo);

                //Act
                var result = target.GetByWeek("Faal maar");

                //Assert
                Assert.AreEqual(0, repo.TimesFindByCalled);
                Assert.IsInstanceOfType(result, typeof(BadRequestObjectResult));
                var testResult = (result as BadRequestObjectResult).Value;
                Assert.AreEqual("datum is niet in juiste format", (testResult as Foutmelding).ErrorMessage);
                Assert.AreEqual(ErrorTypes.IncorrectInputFormat, (testResult as Foutmelding).ErrorType);
            }
        }
Ejemplo n.º 3
0
        public void VindCursusLijstPerWeek()
        {
            using (var repo = new CursusRepositoryMock())
            {
                //Arrange
                Assert.AreEqual(0, repo.TimesFindByCalled);

                var target = new CursusController(repo);
                var cursus = new Cursus()
                {
                    Cursuscode = "test",
                    Duur       = 5,
                    Titel      = "C# testing"
                };

                var cursusInstantie = new CursusInstantie()
                {
                    Startdatum = new DateTime(2016, 10, 10),
                    Cursus     = cursus
                };
                target.Post(cursusInstantie);

                var cursusInstantie2 = new CursusInstantie()
                {
                    Startdatum = new DateTime(2016, 3, 10),
                    Cursus     = cursus
                };
                target.Post(cursusInstantie2);

                //Act
                target.GetByWeek(new DateTime(2016, 3, 10).ToString());

                //Assert
                Assert.AreEqual(1, repo.TimesFindByCalled);
            }
        }