public async Task ReturnsBadRequst_Exception()
        {
            var userServiceMock    = new Mock <IUserService>();
            var wrapperMock        = new Mock <IUserServiceWrapper>();
            var logbookServiceMock = new Mock <ILogbookService>();


            var sut = new UsersController(userServiceMock.Object,
                                          logbookServiceMock.Object,
                                          wrapperMock.Object);


            var model = new IndexNoteViewModel()
            {
                CurrentLogbookId = 2
            };
            var userId = TestHelpersNoteController.TestUserDTO1().Id;

            wrapperMock.Setup(x => x.GetLoggedUserId(It.IsAny <ClaimsPrincipal>())).Returns(userId);
            userServiceMock.Setup(x => x.GetUserByIdAsync(userId)).ReturnsAsync(TestHelpersUsersController.TestUserDTO4());
            logbookServiceMock.Setup(x => x.GetLogbookById(1)).ReturnsAsync(TestHelpersNoteController.TestLogbookDTO1());
            userServiceMock.Setup(x => x.SwitchLogbookAsync(userId, model.CurrentLogbookId.Value)).ThrowsAsync(new Exception());
            var actionResult = await sut.SwitchLogbook(model);

            var result = (RedirectToActionResult)actionResult;

            Assert.AreEqual("Error", result.ActionName);
            Assert.AreEqual("Home", result.ControllerName);
            Assert.IsInstanceOfType(result, typeof(RedirectToActionResult));
        }
        public async Task ReturnsBadRequst_NotFoundFromUserServiceException()
        {
            var userServiceMock    = new Mock <IUserService>();
            var wrapperMock        = new Mock <IUserServiceWrapper>();
            var logbookServiceMock = new Mock <ILogbookService>();


            var sut = new UsersController(userServiceMock.Object,
                                          logbookServiceMock.Object,
                                          wrapperMock.Object);


            var model = new IndexNoteViewModel()
            {
                CurrentLogbookId = 3
            };
            var userId = TestHelpersNoteController.TestUserDTO1().Id;

            wrapperMock.Setup(x => x.GetLoggedUserId(It.IsAny <ClaimsPrincipal>())).Returns(userId);
            userServiceMock.Setup(x => x.GetUserByIdAsync(userId)).ReturnsAsync(TestHelpersUsersController.TestUserDTO4());
            logbookServiceMock.Setup(x => x.GetLogbookById(1)).ReturnsAsync(TestHelpersNoteController.TestLogbookDTO1());
            userServiceMock.Setup(x => x.SwitchLogbookAsync(userId, model.CurrentLogbookId.Value)).ThrowsAsync(new NotFoundException());
            var actionResult = await sut.SwitchLogbook(model);

            Assert.IsInstanceOfType(actionResult, typeof(BadRequestObjectResult));
        }