public void ThenNoValidationErrorsAreReturned()
        {
            var vehicleForm = new VehicleFormModel
                                  {
                                      Name = "vehicle"
                                  };

            var vehicles = new List<Vehicle> { new Vehicle() };
            _vehicleRepo
                .Setup(vr => vr.GetVehicles(UserId))
                .Returns(vehicles);

            var subhandler = MockCanValidateVehicleYearMakeAndModel(vehicleForm);

            var handler = new CanAddVehicle(_vehicleRepo.Object, subhandler);

            var actual = handler.Execute(UserId, vehicleForm);

            Assert.Empty(actual);
        }
        public void WithTooManyVehicles_ThenReturnsValidationResult()
        {
            var vehicleForm = new VehicleFormModel
                                  {
                                      Name = "vehicle"
                                  };

            var vehicles = Enumerable
                .Range(0, CanAddVehicle.MaxNumberOfVehiclesPerUser)
                .Select(i => new Vehicle());

            _vehicleRepo
                .Setup(vr => vr.GetVehicles(UserId))
                .Returns(vehicles);

            var subhandler = MockCanValidateVehicleYearMakeAndModel(vehicleForm);

            var handler = new CanAddVehicle(_vehicleRepo.Object, subhandler);
            var actual = handler.Execute(UserId, vehicleForm).ToList();

            Assert.Equal(1, actual.Count);
            Assert.Contains("maximum number", actual[0].Message, StringComparison.CurrentCultureIgnoreCase);
        }