public void RecentInfoCommandService_CheckNotUsefulPropertyData() { var recentInfoCommandService = GetDependency <IRecentInfoCommandService>(); Assert.IsInstanceOfType(recentInfoCommandService, typeof(IRecentInfoCommandService)); RecentPropertyDetails recentPropertyDetails = MockObjects.NewRecentPropertyDetails; recentPropertyDetails.Serial = null; Guid contributePropertyId = recentInfoCommandService.ContributeProperty(MockObjects.NewContributionDetails, RecentInfoType.FI, recentPropertyDetails); Assert.AreEqual(contributePropertyId, Guid.Empty); Assert.IsInstanceOfType(contributePropertyId, typeof(Guid)); }
public Guid ContributeProperty(ContributionDetails contributionDetails, RecentInfoType recentInfoType, RecentPropertyDetails details) { purgeOldRecords("RecentProperties"); return(UsefulPropertyData(details) ? ProcessContribution(contributionDetails, details, () => new RecentProperty(contributionDetails.As <Domain.RecentInfo.ValueObjects.ContributionDetails>(), recentInfoType)) : Guid.Empty); }
/// <summary> /// Return True if the Property data is useful. /// </summary> private static bool UsefulPropertyData(RecentPropertyDetails property) { return(property != null && !string.IsNullOrWhiteSpace(property.Serial) && !string.IsNullOrWhiteSpace(property.Description)); }