public async Task Delete_Get_ModelIsValid_AsksForDeleteView()
        {
            Mock <BusinessTripService> mock       = new Mock <BusinessTripService>();
            BusinessTripController     controller = GetNewBusinessTripController(mock.Object, null);

            ViewResult result = (await controller.Delete(1)) as ViewResult;

            Assert.AreEqual("Delete", result.ViewName);
        }
        public async Task Delete_Get_ModelIsInvalid_AsksForErrorView()
        {
            Mock <BusinessTripService> mock = new Mock <BusinessTripService>();

            mock.Setup(m => m.FindByIdAsync(It.IsAny <int?>())).Throws(new ValidationException("FindByIdAsync method throws Exception", ""));
            BusinessTripController controller = GetNewBusinessTripController(mock.Object, null);

            ViewResult result = (await controller.Delete(1)) as ViewResult;

            Assert.AreEqual("Error", result.ViewName);
        }
        public async Task Delete_Get_ModelIsInvalid_RetrievesExceptionMessageFromModel()
        {
            Mock <BusinessTripService> mock = new Mock <BusinessTripService>();

            mock.Setup(m => m.FindByIdAsync(It.IsAny <int?>())).Throws(new ValidationException("FindByIdAsync method throws Exception", ""));
            BusinessTripController controller = GetNewBusinessTripController(mock.Object, null);

            ViewResult result = (await controller.Delete(1)) as ViewResult;

            string[] model = result.ViewData.Model as string[];
            Assert.AreEqual("FindByIdAsync method throws Exception", model[0]);
        }
        public async Task Delete_Get_ModelIsValid_RetrievesBusinessTripFromModel()
        {
            Mock <BusinessTripService> mock = new Mock <BusinessTripService>();

            mock.Setup(m => m.FindByIdAsync(It.IsAny <int?>())).ReturnsAsync((int?_id) => new BusinessTripDTO {
                Id   = _id.Value,
                Name = "02.09.2018_026"
            });
            BusinessTripController controller = GetNewBusinessTripController(mock.Object, null);

            ViewResult result = (await controller.Delete(2)) as ViewResult;

            BusinessTripViewModel model = result.ViewData.Model as BusinessTripViewModel;

            Assert.AreEqual(2, model.Id);
            Assert.AreEqual("02.09.2018_026", model.Name);
        }