Ejemplo n.º 1
0
        public void CursusGetTest()
        {
            using (var repo = new CursusRepositoryMock())
            {
                var target = new CursusController(repo);
                Assert.AreEqual(0, repo.TimesCalled);
                target.Get();

                Assert.AreEqual(1, repo.TimesCalled);
            }
        }
Ejemplo n.º 2
0
        public void VindAlleCursussenFaalendFoutmeldingTypeCheck()
        {
            using (var repo = new CursusRepositoryMock())
            {
                //Arrange

                var target = new CursusController(repo);

                //Act
                var result = target.Get();

                //Assert
                Assert.AreEqual(1, repo.TimesFindAllCalled);
                Assert.IsInstanceOfType((result as BadRequestObjectResult).Value, typeof(Foutmelding));
            }
        }
Ejemplo n.º 3
0
        public void CursusSetTest()
        {
            //Assert
            using (var repo = new CursusRepositoryMock())
            {
                Assert.AreEqual(0, repo.TimesFindAllCalled);

                var target = new CursusController(repo);

                //Act
                target.Get();

                //Assert
                Assert.AreEqual(1, repo.TimesFindAllCalled);
            }
        }
Ejemplo n.º 4
0
        public void CursusGetWithIdTest()
        {
            //Assert
            using (var repo = new CursusRepositoryMock())
            {
                Assert.AreEqual(0, repo.TimesFindCalled);

                var target = new CursusController(repo);

                //Act
                var result = target.Get(2);

                //Assert
                Assert.AreEqual(1, repo.TimesFindCalled);
                Assert.AreEqual(2, repo.FindByIdLastCallContent);
            }
        }
Ejemplo n.º 5
0
        public void VindAlleCursussenFaalendErrorMessage()
        {
            using (var repo = new CursusRepositoryMock())
            {
                //Arrange

                var target = new CursusController(repo);

                //Act
                var result = target.Get();

                //Assert
                var testResult = (result as BadRequestObjectResult).Value;
                Assert.AreEqual(1, repo.TimesFindAllCalled);
                Assert.AreEqual("Oops, something went wrong", (testResult as Foutmelding).ErrorMessage);
            }
        }