Пример #1
0
            private SetVenueUploadRowsRecord CreateValidRecord(
                bool isSupplementary = false,
                Guid?venueId         = null,
                bool isDeletable     = true)
            {
                string venueName;

                do
                {
                    venueName = Faker.Company.Name();
                }while (_records.Any(r => r.VenueName == venueName));

                return(CreateRecord(
                           venueId: venueId ?? Guid.NewGuid(),
                           providerVenueRef: Guid.NewGuid().ToString(),
                           venueName,
                           addressLine1: FakerEx.StreetAddressSafe(),
                           addressLine2: Faker.Address.SecondaryAddress(),
                           town: Faker.Address.City(),
                           county: Faker.Address.UkCounty(),
                           postcode: "AB1 2DE",       // Faker's method sometimes produces invalid postcodes :-/
                           email: Faker.Internet.Email(),
                           telephone: "01234 567890", // There's no Faker method for a UK phone number
                           website: Faker.Internet.Url(),
                           isSupplementary: isSupplementary,
                           isDeletable: isDeletable));
            }
        public static IEnumerable <CsvVenueRow> CreateVenueUploadRows(int rowCount)
        {
            var venueNames = new HashSet <string>();

            for (int i = 0; i < rowCount; i++)
            {
                // Venue names have to be unique
                string venueName;
                do
                {
                    venueName = Faker.Company.Name();
                }while (!venueNames.Add(venueName));

                yield return(new CsvVenueRow()
                {
                    ProviderVenueRef = Guid.NewGuid().ToString(),
                    VenueName = venueName,
                    AddressLine1 = FakerEx.StreetAddressSafe(),
                    AddressLine2 = Faker.Address.SecondaryAddress(),
                    Town = Faker.Address.City(),
                    County = Faker.Address.UkCounty(),
                    Postcode = "AB1 2DE",       // Faker's method sometimes produces invalid postcodes :-/
                    Email = Faker.Internet.Email(),
                    Telephone = "01234 567890", // There's no Faker method for a UK phone number
                    Website = Faker.Internet.Url()
                });
            }
        }