public void WhenGettingFillupsAndRepositoryThrows_ThenWrapsException() { _fillupRepositoryMock .Setup(f => f.GetFillups(DefaultVehicleId)) .Throws <InvalidOperationException>(); var handler = new GetFillupsForVehicle(_fillupRepositoryMock.Object); var ex = Assert.Throws <BusinessServicesException>(() => handler.Execute(DefaultVehicleId)); Assert.IsType <InvalidOperationException>(ex.InnerException); }
public object GetFillUps(int vehicleId) { var fillUps = getFillupsForVehicle.Execute(vehicleId); return(new Page("Vehicles/FillUps/init") { Title = "Fill ups", MasterPage = Url.Resource <GetVehicleMasterPageController>(), Data = new { fillUps, add = Url.Post <GetFillUpsController>() } }); }