SqlSugar源码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.5 KiB

8 years ago
using System;
using System.Collections.Generic;
using SqlSugar;
using System.Linq;
8 years ago
namespace OrmTest.UnitTest
8 years ago
{
8 years ago
public class UnitTestBase
8 years ago
{
public int Count { get; set; }
private DateTime BeginTime { get; set; }
private DateTime EndTime { get; set; }
public void Begin()
{
this.BeginTime = DateTime.Now;
}
public void End(string title)
{
this.EndTime = DateTime.Now;
Console.WriteLine(title + " \r\nCount: " + this.Count + "\r\nTime: " + (this.EndTime - this.BeginTime).TotalSeconds + " Seconds \r\n");
}
8 years ago
internal void Check(string value, List<SugarParameter> pars, string validValue, List<SugarParameter> validPars, string errorMessage)
8 years ago
{
8 years ago
if (value.Trim() != validValue.Trim())
8 years ago
{
throw new Exception(errorMessage);
}
if (pars != null && pars.Count > 0)
{
if (pars.Count != validPars.Count)
{
throw new Exception(errorMessage);
}
else
{
foreach (var item in pars)
{
if (!validPars.Any(it => it.ParameterName.Equals(item.ParameterName) && it.Value.Equals(item.Value)))
{
throw new Exception(errorMessage);
}
}
}
}
}
}
}