Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

GenFu Nullable DateTime Issue

$
0
0

I am very new to GenFu (using ver 1.6.0) and any help getting started would be appreciated. I can get GenFu to generate data for nullable fields. But, for a "DateTime?" field, I would like to further constrain the dates being generated to be past dates. How can I use the "AsPastDate" with a "DateTime?" field?

For example:

public class Employee{    public string Name { get; set; }    public DateTime StartDate { get; set; }    public DateTime? EndDate { get; set; }}public class TestGenfu{    public List<Employee> GetRandEmpList(int numEmps)    {        var itemNum = 0;        A.Configure<Employee>()            .Fill(d => d.Name, () => $"EmployeeNumber{itemNum++}")            .Fill(d => d.StartDate).AsPastDate()            .Fill(d => d.EndDate).AsPastDate()            ;        return A.ListOf<Employee>(numEmps);    }}

The AsPastDate works for the StartDate, but for the EndDate it gives a "cannot resolve symbol".


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>