How to create a data table using fixture while unit testing

427 views Asked by At
private DataTable GetRuleCategoryTable()
{
      // RuleCategory rc = new RuleCategory();
      DataTable dtRuleCategory = _fixture.Build<DataTable>()
                .With(x => x.Columns.Add("RuleCategoryName", typeof(System.String)))
                .With(x => x.Columns.Add("OrganizationID", typeof(System.Int32)))
                .With(x => x.Columns.Add("RuleEntryCode", typeof(System.Int32)))
                .With(x => x.Columns.Add("IsActive", typeof(System.Boolean)))
                .With(x => x.Columns.Add("RuleCategoryLookupId", typeof(System.Boolean)))                
                 .Create();
            return dtRuleCategory;
}

Above code throws exception -

The expression's Body is not a Member Expression.

Most likely this is because it does not represent access to a property or field

0

There are 0 answers