Beispiel #1
0
 public SkeletonFabricator(FabSupport context) : base(context)
 {
     Fixture.AddConvention(cfg =>
     {
         cfg.IfPropertyNameIs("Name").Use(f => f.Name.FullName());
     });
 }
Beispiel #2
0
        public MongFabricator(FabSupport context) : base(context)
        {
            Fixture.AddConvention(cfg =>
            {
                cfg.IfPropertyNameIs("Amount").Use(f => decimal.Round(f.Random.Decimal(5, 100), 2));

                cfg.IfPropertyNameIs("TransactionId").Use(() => Guid.NewGuid().ToString());
                cfg.IfPropertyNameIs("PaymentId").Use(() => Guid.NewGuid().ToString());

                cfg.IfPropertyNameIs("BlockedAt").Use(() => null);
            });
        }
Beispiel #3
0
        public PlaygroundFabricator(FabSupport context) : base(context)
        {
            Fixture.AddConvention(cfg =>
            {
                cfg.IfPropertyNameIs("Name").Use(f => f.Name.FullName());
            });

            WithDefault <TableList.Product>(x =>
            {
                x.ProductName     = Faker.Commerce.ProductName();
                x.ProductPrice    = Faker.Random.Decimal(0.5m, 99.99m);
                x.ProductLastSale = Faker.Date.Past(1);
            });
        }
Beispiel #4
0
        public SelfImprovFabricator(FabSupport context) : base(context)
        {
            Fixture.AddConvention(_ =>
            {
                _.IfPropertyNameIs("Name").Use(f => f.Name.FullName());

                _.IfPropertyImplements <IUser>().Ignore();

                // TODO: Support IfPropertyIs<IInactivable>(m => m.IsInactive)
                _.IfPropertyNameIs(nameof(IInactivable.IsInactive)).Use(false);

                _.IfPropertyNameStarts("Password").Use("123456");
                _.IfPropertyNameIs("HashedPassword").Use(() => Hash.Create("123456"));
            });
        }
Beispiel #5
0
            public ThisFabricator(FabSupport support) : base(support)
            {
                support.Fixture.AddConvention(_ =>
                {
                    _.IfPropertyNameIs(nameof(Customer.Rank)).Use(10);
                });

                WithDefault <Customer>(x =>
                {
                    x.Status   = "regular-buyer";
                    x.IsActive = true;
                });

                WithDefault <PaymentProvider>((x, faker) =>
                {
                    x.Name = faker.PickRandom("PayPal", "Stripe");
                });
            }
Beispiel #6
0
        public SupportreonFabricator(FabSupport context) : base(context)
        {
            Fixture.AddConvention(conv =>
            {
                conv.IfPropertyNameIs(nameof(Project.Description))
                .Use(f => f.Lorem.Paragraphs(1));

                conv.IfPropertyIs <Project>(p => p.EndDate)
                .Use(f => f.Date.Future());

                conv.IfPropertyNameIs(nameof(Project.MinimumDonation))
                .Use(f => f.Finance.Amount(min: Donation.Minimum, max: 7));

                conv.IfPropertyNameIs(nameof(Donation.Amount))
                .Use(f => f.Finance.Amount(min: 7, max: 50));

                conv.IfPropertyNameIs(nameof(Donation.CreditCard))
                .Use(f => f.Random.String2(10, "1234567890"));

                conv.IfPropertyNameIs(nameof(Project.CreatedAt))
                .Use(f => DateTime.Now);
            });
        }
Beispiel #7
0
 public CategoryFabricator(FabSupport support) : base(support)
 {
 }
Beispiel #8
0
 public ThisFabricator(FabSupport support) : base(support)
 {
 }
Beispiel #9
0
 public UserFabricator(FabSupport support) : base(support)
 {
 }
 public ProductFabricator(FabSupport fabricator) : base(fabricator)
 {
 }
 public ThisFabricator(FabSupport context) : base(context)
 {
 }