public void OnderhoudController_StartNieuwOnderhoudsOpdracht_Success()
        {
            // Arrange
            var repoMock = new Mock <IRepository>(MockBehavior.Strict);

            repoMock.Setup(r => r.Find(It.IsAny <Guid>())).Returns(new OnderhoudsOpdracht()
            {
                Guid = new Guid("0f8fad5b-d9cb-469f-a165-70867728950e"), OpdrachtStatus = Status.Onderhoud
            });
            repoMock.Setup(r => r.Update(It.IsAny <OnderhoudsOpdracht>()));

            var pubMock = new Mock <IEventPublisher>(MockBehavior.Strict);

            pubMock.Setup(p => p.Publish(It.IsAny <OnderhoudsOpdrachtGestartEvent>()));

            var target = new OnderhoudController(repoMock.Object, pubMock.Object);

            var command = new StartOnderhoudOpdrachtCommand(new Guid("0f8fad5b-d9cb-469f-a165-70867728950e"));

            // Act
            IActionResult result = target.StartNieuwOnderhoudsOpdracht(command);

            // Assert
            Assert.IsInstanceOfType(result, typeof(OkResult));
            repoMock.Verify(r => r.Find(It.IsAny <Guid>()), Times.Once());
            repoMock.Verify(r => r.Update(It.IsAny <OnderhoudsOpdracht>()), Times.Once());
            pubMock.Verify(p => p.Publish(It.IsAny <OnderhoudsOpdrachtGestartEvent>()), Times.Once());
        }
        public void OnderhoudController_StartNieuwOnderhoudsOpdracht_Fail()
        {
            // Arrange
            var repoMock = new Mock <IRepository>(MockBehavior.Strict);

            repoMock.Setup(r => r.Find(It.IsAny <Guid>()));
            repoMock.Setup(r => r.Update(It.IsAny <OnderhoudsOpdracht>()));

            var pubMock = new Mock <IEventPublisher>(MockBehavior.Strict);

            pubMock.Setup(p => p.Publish(It.IsAny <OnderhoudsOpdrachtGestartEvent>()));

            var target = new OnderhoudController(repoMock.Object, pubMock.Object);

            // Act
            IActionResult result = target.StartNieuwOnderhoudsOpdracht(null);

            // Assert
            Assert.IsInstanceOfType(result, typeof(BadRequestResult));
            repoMock.Verify(r => r.Find(It.IsAny <Guid>()), Times.Never());
            repoMock.Verify(r => r.Update(It.IsAny <OnderhoudsOpdracht>()), Times.Never());
            pubMock.Verify(p => p.Publish(It.IsAny <OnderhoudsOpdrachtGestartEvent>()), Times.Never());
        }