Ejemplo n.º 1
0
 /// <summary>
 /// Returns True if the Vehicle data is useful.
 /// </summary>
 private static bool UsefulVehicleData(RecentVehicleDetails vehicle)
 {
     return(vehicle != null &&
            UsefulCodeValueData(vehicle.Make) &&
            UsefulCodeValueData(vehicle.Model) &&
            !string.IsNullOrWhiteSpace(vehicle.PlateNumber) &&
            !string.IsNullOrWhiteSpace(vehicle.Year));
 }
        public void RecentInfoCommandService_CheckNotUsefulVehicleData()
        {
            var recentInfoCommandService = GetDependency <IRecentInfoCommandService>();

            Assert.IsInstanceOfType(recentInfoCommandService, typeof(IRecentInfoCommandService));
            RecentVehicleDetails recentVehicleDetails = MockObjects.NewRecentVehicleDetails;

            recentVehicleDetails.Make = null;
            Guid contributeVehicleId = recentInfoCommandService.ContributeVehicle(MockObjects.NewContributionDetails, RecentInfoType.FI, recentVehicleDetails);

            Assert.AreEqual(contributeVehicleId, Guid.Empty);
            Assert.IsInstanceOfType(contributeVehicleId, typeof(Guid));
        }
Ejemplo n.º 3
0
        public Guid ContributeVehicle(ContributionDetails contributionDetails, RecentInfoType recentInfoType, RecentVehicleDetails details)
        {
            purgeOldRecords("RecentVehicles");

            return(UsefulVehicleData(details)
                ? ProcessContribution(contributionDetails, details,
                                      () => new RecentVehicle(contributionDetails.As <Domain.RecentInfo.ValueObjects.ContributionDetails>(), recentInfoType))
                : Guid.Empty);
        }