Exemplo n.º 1
0
        public void Bug170_CreationError_RegressionTest_SequenceContainedNullElement()
        {
            // SimplCommerce.Module.Catalog.Components.CategoryBreadcrumbViewComponent.Invoke(long ?, System.Collections.Generic.IEnumerable<long>)
            // SimplCommerce\src\Modules\SimplCommerce.Module.Shipping\Models\ShippingProvider.cs :: get_OnlyCountryIds
            // SimplCommerce\src\Modules\SimplCommerce.Module.Shipping\Models\ShippingProvider.cs :: get_OnlyStateOrProvinceIds

            // Exception at: UcfgInstructionFactory.CreateFunctionCall

            const string code = @"
namespace SimplCommerce.Module.Shipping.Models
{
    using System.Collections.Generic;
    using System.Linq;

    public class ShippingProvider //: EntityBase
    {
        public string OnlyCountryIdsString { get; set; }

        public IList<long> OnlyCountryIds
        {
            get
            {
                if (string.IsNullOrWhiteSpace(OnlyCountryIdsString))
                    // %0 := SimplCommerce.Module.Shipping.Models.ShippingProvider.OnlyCountryIdsString.get [ this ]
                    // %1 := string.IsNullOrWhiteSpace(string) [ string %0 ]
                {
                    return new List<long>();
                        // %2 := new System.Collections.Generic.List<T>
                        // %3 := System.Collections.Generic.List<T>.List() [ %2 ]
                }

                return OnlyCountryIdsString.Split(',')
                        // %4 := SimplCommerce.Module.Shipping.Models.ShippingProvider.OnlyCountryIdsString.get [ this ]
                        // %5 := string.Split(params char[]) [ %4 const ]
                    .Select(long.Parse)
                        // %6 := System.Linq.Enumerable.Select<TSource, TResult>(System.Collections.Generic.IEnumerable<TSource>, System.Func<TSource, TResult>) [ System.Linq.Enumerable %5 const ]
                    .ToList();
                        // %7 := System.Linq.Enumerable.ToList<TSource>(System.Collections.Generic.IEnumerable<TSource>) [ System.Linq.Enumerable %6 ]
            }
        }
    }
}
";

            UcfgVerifier.VerifyInstructionsForPropertyGetter(code, "OnlyCountryIds");
        }