参数化构造函数的nunit测试

时间:2014-05-29 10:49:19

标签: constructor nunit

我被要求测试一个参数化的构造函数。不明白为什么它是必要的。分享你的想法。任何解决方案请分享。 以下是代码,

 public class CaseItemReport
{
    #region Members

    #region core referral members
    private long _ReportId;
    private long _CaseIdItem;
    private CaseReport _CaseReport;
    private DateTime _CreationDate;
    private int _Accuracy;
    private int _Severity;
    private int _Visibility;
    #endregion

    #region report result members
    private ReportResult _Result;
    private long _Reason;
    #endregion


                #region Constructors
         public CaseItemReport(CaseReport cr)
    {
        this._CaseReport = cr;
        this.ReportId = -1;
        this.CaseIdItem = cr.CaseIdUser;
        this.CreationDate = DateTime.Now;
        this.Accuracy = 0;
        this.Severity = 0;
        this.Visibility = 0;
        this.Reason = 0;
        this.Result = ReportResult.ACTION;
    }


   public class CaseReport : BusinessObjectBase
{
    public CaseReport()
    {

    }

    public string BreadCrumb { get; set; }
    public bool CanAutomate { get; set; }
    public long CaseIdUser { get; set; }
    //public Consequence Consequence { get; set; }
    public DateTime EarliestItemStartDate { get; set; }
    public string EmailAddressFrom { get; set; }
    public string FilterName { get; set; }
    public bool IsEMR { get; set; }
    public bool IsMemberLevelReferral { get; set; }
    public bool IsPolice { get; set; }
    public bool IsSheriff { get; set; }
    public bool IsValidReport

我需要为构造函数CaseItemReport.Please帮助

编写测试用例

1 个答案:

答案 0 :(得分:0)

Test
{
CaseReport cr;
//assign some values to cr.

 CaseItemReport caseItemReport (cr);

// now verify that all values are set and in working condition or not.

}

我希望你明白这一点