public async Task GetAllWillReturnListOfCursusInstanties()
        {
            // ARRANGE
            _cursusInstantieService.Setup(x => x.GetAllAsync())
            .Returns(Task.FromResult(new List <CursusInstantie> {
                new CursusInstantie()
                {
                    Id = 1, Cursus = CursusBuilder.GetCursus(1, "ABC", "Test1")
                },
                new CursusInstantie()
                {
                    Id = 2, Cursus = CursusBuilder.GetCursus(2, "DEF", "Test2")
                },
                new CursusInstantie()
                {
                    Id = 3, Cursus = CursusBuilder.GetCursus(3, "GHI", "Test3")
                },
            }));

            // Act
            var result = await _cursusInstantieController.GetAllAsync();

            var objectResult = result as OkNegotiatedContentResult <List <CursusInstantieToDetailsDto> >;

            // Assert
            Assert.IsNotNull(objectResult);
            Assert.IsTrue(objectResult.Content.Count == 3);
            Assert.IsNotNull(objectResult.Content.FirstOrDefault(x => x.Id == 3));
        }
        public async Task GetAllBCorrectyWeekShouldReturnOkResult()
        {
            // ARRANGE
            var week = 24;
            var year = 2020;

            _cursusInstantieService.Setup(x => x.GetAllByWeekAndYearAsync(year, week))
            .Returns(Task.FromResult(new List <CursusInstantie>()
            {
                new CursusInstantie()
                {
                    Id = 1, Cursus = CursusBuilder.GetCursus(1, "ABC", "Test1")
                },
                new CursusInstantie()
                {
                    Id = 2, Cursus = CursusBuilder.GetCursus(2, "DEF", "Test2")
                },
                new CursusInstantie()
                {
                    Id = 3, Cursus = CursusBuilder.GetCursus(3, "GHI", "Test3")
                },
            }));
            // ACT
            var result = await _cursusInstantieController.GetAllByWeekAsync(year, week);

            var objectResult = result as OkNegotiatedContentResult <List <CursusInstantieToDetailsDto> >;

            // Assert
            Assert.IsNotNull(objectResult);
            Assert.IsTrue(objectResult.Content.Count == 3);
            Assert.IsNotNull(objectResult.Content.FirstOrDefault(x => x.Id == 3));
        }
        public async Task GetByIdWillResultInOkResult()
        {
            // ARRANGE
            _cursusService.Setup(x => x.GetAsync(It.IsAny <int>()))
            .Returns(Task.FromResult(CursusBuilder.GetCursus(1, "TTT", "Test")));

            // Act
            var result = await _cursussenController.GetByIdAsync(It.IsAny <int>());

            var objectResult = result as OkNegotiatedContentResult <CursusToDetailsDto>;

            // Assert
            Assert.IsNotNull(objectResult);
            Assert.IsTrue(objectResult.Content.Id == 1);
        }
        public async Task GetByIdWillResultInOkResult()
        {
            // ARRANGE
            _cursusInstantieService.Setup(x => x.GetAsync(It.IsAny <int>()))
            .Returns(Task.FromResult(new CursusInstantie {
                Id = 1, Cursus = CursusBuilder.GetCursus(1, "ABC", "Test1"), StartDatum = DateTime.Today, CursusId = 1
            }));

            // Act
            var result = await _cursusInstantieController.GetByIdAsync(It.IsAny <int>());

            var objectResult = result as OkNegotiatedContentResult <CursusInstantieToDetailsDto>;

            // Assert
            Assert.IsNotNull(objectResult);
            Assert.IsTrue(objectResult.Content.Id == 1);
        }
        public async Task CreateWithValidReturnsCreatedResult()
        {
            // ARRANGE
            var cursusToCreate = CursusBuilder.GetCursus(1, "test", "testtitel");

            _cursusService.Setup(x => x.CreateAsync(It.IsAny <Cursus>()))
            .Returns(Task.FromResult(cursusToCreate));
            var inputDto = new CursusToCreateDto {
                Titel = cursusToCreate.Titel, Code = cursusToCreate.Code
            };
            // Act
            var result = await _cursussenController.CreateAsync(inputDto);

            var objectResult = result as CreatedNegotiatedContentResult <CursusToDetailsDto>;

            // Assert
            Assert.IsNotNull(objectResult);
        }
        public async Task UpdateWithValidReturnsCreatedResult()
        {
            // ARRANGE
            var newTitle       = "new title";
            var cursusToUpdate = CursusBuilder.GetCursus(1, "test", newTitle);
            var inputDto       = new CursusToUpdateDto {
                Id = 1, Titel = newTitle, Code = cursusToUpdate.Code
            };

            _cursusService.Setup(x => x.UpdateAsync(It.IsAny <Cursus>()))
            .Returns(Task.FromResult(cursusToUpdate));

            // Act
            var result = await _cursussenController.UpdateAsync(inputDto);

            var objectResult = result as OkNegotiatedContentResult <CursusToDetailsDto>;

            // Assert
            Assert.IsNotNull(objectResult);
            Assert.IsTrue(objectResult.Content.Titel.Equals(newTitle));
        }