コード例 #1
0
 protected virtual UCommerceProductDescription GenerateDescription(UCommerceProduct product, string languageCode)
 {
     return(_productDescriptionFaker
            .RuleFor(x => x.CultureCode, f => languageCode)
            .RuleFor(x => x.DisplayName, f => $"{product.Name} {f.Vehicle.Fuel()}")
            .RuleFor(x => x.ProductId, f => product.ProductId)
            .Generate());
 }
コード例 #2
0
        protected override UCommerceProductDescription GenerateDescription(UCommerceProduct product,
                                                                           string languageCode)
        {
            string parentDisplayName = product.ParentProduct
                                       ?.UCommerceProductDescription
                                       ?.FirstOrDefault(d => d.CultureCode == languageCode)
                                       ?.DisplayName ?? "";

            return(_productDescriptionFaker
                   .RuleFor(x => x.CultureCode, f => languageCode)
                   .RuleFor(x => x.DisplayName, f => $"{parentDisplayName} {f.Commerce.Color()}")
                   .RuleFor(x => x.ProductId, f => product.ProductId)
                   .Generate());
        }