public static AllocationAmountsFact Create(AllocationAmountsFactBuilderOptions opts) { var faker = new Faker <AllocationAmountsFact>() .RuleFor(a => a.OrganizationId, f => opts.OrganizationsDim?.OrganizationId ?? OrganizationsDimBuilder.GenerateId()) .RuleFor(a => a.VariableSpecificId, f => opts.VariablesDim?.VariableSpecificId ?? VariablesDimBuilder.GenerateId()) .RuleFor(a => a.WaterSourceId, f => opts.WaterSourcesDim?.WaterSourceId ?? WaterSourcesDimBuilder.GenerateId()) .RuleFor(a => a.MethodId, f => opts.MethodsDim?.MethodId ?? MethodsDimBuilder.GenerateId()) .RuleFor(a => a.PrimaryUseCategoryCV, f => opts.PrimaryBeneficialUsesCv?.Name) .RuleFor(a => a.DataPublicationDateId, f => opts.DataPublicationDate?.DateId ?? DateDimBuilder.GenerateId()) .RuleFor(a => a.DataPublicationDoi, f => f.Random.Words(3)) .RuleFor(a => a.AllocationNativeId, f => f.Random.Uuid().ToString()) .RuleFor(a => a.DataPublicationDoi, f => f.Random.Word()) .RuleFor(a => a.AllocationApplicationDateID, f => opts.AllocationApplicationDate?.DateId) .RuleFor(a => a.AllocationPriorityDateID, f => opts.AllocationPriorityDate?.DateId ?? DateDimBuilder.GenerateId()) .RuleFor(a => a.AllocationExpirationDateID, f => opts.AllocationExpirationDate?.DateId) .RuleFor(a => a.AllocationOwner, f => f.Name.FullName()) .RuleFor(a => a.AllocationBasisCv, f => opts.WaterAllocationBasis?.Name) .RuleFor(a => a.AllocationLegalStatusCv, f => opts.LegalStatus?.Name) .RuleFor(a => a.AllocationTypeCv, f => opts.WaterAllocationType?.Name) .RuleFor(a => a.AllocationTimeframeEnd, f => opts.AllocationTimeframeStartDate?.Date.ToString("mm/dd")) .RuleFor(a => a.AllocationTimeframeEnd, f => opts.AllocationTimeframeEndDate?.Date.ToString("mm/dd")) .RuleFor(a => a.AllocationAmount, f => f.Random.Double(0, 1000)) .RuleFor(a => a.AllocationMaximum, f => f.Random.Double(0, 1000)) ; switch (opts.RecordType ?? (new Faker()).PickRandom <WaterAllocationRecordType>()) { case WaterAllocationRecordType.Ag: faker.RuleFor(a => a.IrrigatedAcreage, f => f.Random.Double(0, 10000)) .RuleFor(a => a.CropTypeCV, f => opts.CropType?.Name) .RuleFor(a => a.IrrigationMethodCV, f => opts.IrrigationMethod?.Name) .RuleFor(a => a.AllocationCropDutyAmount, f => f.Random.Double(0, 1000)); break; case WaterAllocationRecordType.Power: faker.RuleFor(a => a.GeneratedPowerCapacityMW, f => f.Random.Double(0, 10000)); break; case WaterAllocationRecordType.Civilian: faker.RuleFor(a => a.PopulationServed, f => f.Random.Long(0, 10000000)) .RuleFor(a => a.CommunityWaterSupplySystem, f => f.Address.City()) .RuleFor(a => a.CustomerTypeCV, f => opts.CustomerType?.Name) .RuleFor(a => a.SdwisidentifierCV, f => opts.SDWISIdentifier?.Name); break; } return(faker); }
public static AggregatedAmountsFact Create(AggregatedAmountsFactBuilderOptions opts) { var faker = new Faker <AggregatedAmountsFact>() .RuleFor(a => a.OrganizationId, f => opts.OrganizationsDim?.OrganizationId ?? OrganizationsDimBuilder.GenerateId()) .RuleFor(a => a.ReportingUnitId, f => opts.ReportingUnitsDim?.ReportingUnitId ?? ReportingUnitsDimBuilder.GenerateId()) .RuleFor(a => a.VariableSpecificId, f => opts.VariablesDim?.VariableSpecificId ?? VariablesDimBuilder.GenerateId()) .RuleFor(a => a.PrimaryUseCategoryCV, f => opts.PrimaryBeneficialUsesCv?.Name) .RuleFor(a => a.WaterSourceId, f => opts.WaterSourcesDim?.WaterSourceId ?? WaterSourcesDimBuilder.GenerateId()) .RuleFor(a => a.MethodId, f => opts.MethodsDim?.MethodId ?? MethodsDimBuilder.GenerateId()) .RuleFor(a => a.TimeframeStartId, f => opts.TimeframeStart?.DateId) .RuleFor(a => a.TimeframeEndId, f => opts.TimeframeEnd?.DateId) .RuleFor(a => a.DataPublicationDateID, f => opts.DataPublicationDate?.DateId) .RuleFor(a => a.DataPublicationDoi, f => f.Random.Word()) .RuleFor(a => a.ReportYearCv, f => opts.ReportYearCv?.Name) .RuleFor(a => a.Amount, f => f.Random.Double(0, 5000)) .RuleFor(a => a.InterbasinTransferToId, f => f.Random.AlphaNumeric(20)) .RuleFor(a => a.InterbasinTransferFromId, f => f.Random.AlphaNumeric(20)); switch (opts.RecordType ?? (new Faker()).PickRandom <AggregatedAmountsRecordType>()) { case AggregatedAmountsRecordType.Ag: faker.RuleFor(a => a.IrrigatedAcreage, f => f.Random.Double(0, 10000)) .RuleFor(a => a.CropTypeCV, f => opts.CropType?.Name) .RuleFor(a => a.IrrigationMethodCV, f => opts.IrrigationMethod?.Name) .RuleFor(a => a.AllocationCropDutyAmount, f => f.Random.Double(0, 50000)); break; case AggregatedAmountsRecordType.Power: faker.RuleFor(a => a.PowerGeneratedGwh, f => f.Random.Double(0, 10000)); break; case AggregatedAmountsRecordType.Civilian: faker.RuleFor(a => a.PopulationServed, f => f.Random.Long(0, 10000000)) .RuleFor(a => a.CommunityWaterSupplySystem, f => f.Address.City()) .RuleFor(a => a.CustomerTypeCV, f => opts.CustomerType?.Name) .RuleFor(a => a.SDWISIdentifierCV, f => opts.SDWISIdentifier?.Name); break; } return(faker); }