Notice: 当constructor为private的时候,new MXxxxxxx().Instance , 否则就可以直接new, 但要moles constructor
using System.Data.Objects.Moles;
public void GetProjectInfoTest()
{
MXTRACHoldingDBEntities.AllInstances.GetProjectSettingString = (obj, fileName) =>
{
MObjectResult01<ProjectInfo> result = new MObjectResult01<ProjectInfo>();
result.Bind(
new List<ProjectInfo>()
{
new ProjectInfo()
{
ProjectName = "Project",
ProjectDescription = "Description",
//other properties
}
});
return result.Instance;
};
//other codes and Assert
}