Пример #1
0
        private void InitializeObject(bool useValidLookupValues)
        {
            SetProperty(x => x.LogBits, new ProductLogBits());
            SetProperty(x => x.Id, ARandom.IntBetween(1000000, 2000000));
            SetProperty(x => x.ProductTypeId, (Enums.ProductType)ARandom.IntBetween(1, 2));
            SetProperty(x => x.ActiveInWebshop, ARandom.Boolean());
            SetProperty(x => x.Name_NL, "Test_" + ARandom.Text(200).TrimEnd());
            SetProperty(x => x.Name_EN, "Test_" + ARandom.Text(200).TrimEnd());
            SetProperty(x => x.Subtitle_NL, ARandom.Text(300).TrimEnd());
            SetProperty(x => x.ReferenceNumber, ARandom.Text(20).TrimEnd());
            SetProperty(x => x.Isbn, ARandom.String(13));
            SetProperty(x => x.Ismn, ARandom.String(13));
            SetProperty(x => x.Ean, ARandom.String(13));
            SetProperty(x => x.Upc, ARandom.String(12));
            SetProperty(x => x.GradeLevel, ARandom.String(10));
            SetProperty(x => x.Pages, ARandom.IntBetween(1, Int16.MaxValue));
            SetProperty(x => x.SalesPrice, ARandom.CurrencyAmountLessThan(100000));
            SetProperty(x => x.TaxRateId, (Enums.TaxRate)ARandom.IntBetween(1, 2));
            SetProperty(x => x.Description_NL, ARandom.Text(500).TrimEnd());
            SetProperty(x => x.Weight, ARandom.CurrencyAmountLessThan(100));
            SetProperty(x => x.Length, ARandom.CurrencyAmountLessThan(100));
            SetProperty(x => x.Width, ARandom.CurrencyAmountLessThan(100));
            SetProperty(x => x.Height, ARandom.CurrencyAmountLessThan(100));
            SetProperty(x => x.InternalStock, ARandom.PositiveInt());
            SetProperty(x => x.ExternalStock, ARandom.PositiveInt());
            SetProperty(x => x.TeacherDiscount, (byte)ARandom.IntBetween(0, 100));
            SetProperty(x => x.ResellerDiscount, (byte)ARandom.IntBetween(0, 100));
            SetProperty(x => x.Promotion, ARandom.Boolean());
            SetProperty(x => x.HighlightOnHome, ARandom.Boolean());
            //TODO: set Besteller property to ARandom.Boolean() when BestSeller is properly supported
            SetProperty(x => x.BestSeller, false);
            SetProperty(x => x.MinimumOrderQuantity, ARandom.IntBetween(1, 500));
            SetProperty(x => x.SearchKeywords, ARandom.Text(200));
            SetProperty(x => x.StorePickupOnly, ARandom.Boolean());
            SetProperty(x => x.Test, true);
            SetProperty(x => x.CreatedDttm, ARandom.DateTimeInPast());
            SetProperty(x => x.UpdatedDttm, ARandom.DateTimeInPast());
            SetProperty(x => x.DeletedDttm, (DateTime?)null);

            SetProperty(x => x.Songs, GetRandomSonglist(5, useValidLookupValues));
            SetProperty(x => x.ProductPictures, GetRandomProductPictures(5));
            SetProperty(x => x.ProductCategories, GetRandomProductCategories(5, useValidLookupValues));

            var pdo = new PredefinedDataObjects();

            SetProperty(x => x.AuthorId, useValidLookupValues ? pdo.Author.Id : ARandom.PositiveInt());
            SetProperty(x => x.ArrangerId, useValidLookupValues ? pdo.Author.Id : ARandom.PositiveInt());
            SetProperty(x => x.SupplierId, useValidLookupValues ? pdo.Supplier.Id : ARandom.PositiveInt());
            SetProperty(x => x.ManufacturerId, useValidLookupValues ? pdo.Manufacturer.Id : ARandom.PositiveInt());
            SetProperty(x => x.InstrumentId, useValidLookupValues ? pdo.Instrument.Id : ARandom.PositiveInt());
            SetProperty(x => x.LanguageId, ARandom.EnumValue <Enums.Language>());
            SetProperty(x => x.BindingId, useValidLookupValues ? pdo.Binding.Id : ARandom.PositiveInt());
            SetProperty(x => x.SeriesId, useValidLookupValues ? pdo.ProductSeries.Id : ARandom.PositiveInt());
        }
 public AnonymousCustomerBuilder()
 {
     SetProperty(x => x.StoreId, ARandom.IntBetween(1000000, int.MaxValue));
     //SetProperty(x => x.WebshopId, ARandom.IntBetween(1000000, int.MaxValue));
     SetProperty(x => x.LastName, "Test_" + ARandom.LastName());
     SetProperty(x => x.FirstName, "Test_" + ARandom.FirstName());
     SetProperty(x => x.ShippingAddressStreet, "Test_" + ARandom.Text(15).TrimEnd());
     SetProperty(x => x.ShippingAddressHomeNumber, ARandom.Text(5).TrimEnd());
     SetProperty(x => x.ShippingAddressCity, ARandom.City());
     SetProperty(x => x.ShippingAddressZip, ARandom.ZipCode());
     SetProperty(x => x.ShippingAddressState, "");
     SetProperty(x => x.ShippingAddressCountryId, (int?)ARandom.EnumValue <Enums.Country>());
     SetProperty(x => x.ShippingAddressCountry, Enum.GetName(typeof(Enums.Country), ARandom.EnumValue <Enums.Country>()));
     SetProperty(x => x.Phone, ARandom.StringPattern("##/### ## ##"));
     SetProperty(x => x.Mobile, ARandom.StringPattern("####/## ## ##"));
     SetProperty(x => x.Email, "archive+" + ARandom.StringFromCharacterSet(15, "abcdefghijklmnopqrstuvwxyz").TrimEnd() + "@animatomusic.be");
     SetProperty(x => x.BillingAddress1, ARandom.Text(15).TrimEnd());
     SetProperty(x => x.BillingAddress2, ARandom.Text(15).TrimEnd());
     SetProperty(x => x.BillingAddress3, ARandom.Text(15).TrimEnd());
     SetProperty(x => x.BillingName, ARandom.Text(30).TrimEnd());
     SetProperty(x => x.BillingContact, ARandom.Text(30).TrimEnd());
     SetProperty(x => x.VatNumber, ARandom.Text(15).TrimEnd());
     SetProperty(x => x.WebshopDiscount6, (byte)ARandom.IntBetween(0, 100));
     SetProperty(x => x.WebshopDiscount21, (byte)ARandom.IntBetween(0, 100));
     SetProperty(x => x.IsTeacher, ARandom.Boolean());
     SetProperty(x => x.IsReseller, ARandom.Boolean());
     SetProperty(x => x.Institution, ARandom.Text(50).TrimEnd());
     SetProperty(x => x.TeacherCardNumber, "17511240450-000010");
     SetProperty(x => x.TeacherCardValidFrom, ARandom.DateAfter(DateTime.Today));
     SetProperty(x => x.TeacherCardValidTo, ARandom.DateAfter(DateTime.Today));
     SetProperty(x => x.TeacherRegistrationNote, ARandom.Text(150).TrimEnd());
     SetProperty(x => x.TeacherConfirmed, ARandom.DateTime());
     SetProperty(x => x.TeachingSubjects, ARandom.Text(50).TrimEnd());
     SetProperty(x => x.Test, true);
     SetProperty(x => x.CreatedDttm, ARandom.DateTimeInPast());
     SetProperty(x => x.UpdatedDttm, ARandom.DateTimeInPast());
     SetProperty(x => x.DeletedDttm, (DateTime?)null);
 }
Пример #3
0
 public void should_return_the_specified_enum_type() =>
 ARandom.EnumValue <TestEnum>().Should().BeOfType <TestEnum>();