私のデータコンテキストには、テーブル UserProfile との 1 対多の関係を持つ Userlog という名前のテーブルが含まれています。
クラス内 UserLog
public UserProfile UserProfile
{
get {return this._UserProfile.Entity;}
}
クラス UserProfile 内
public EntitySet<UserLog> UserLogs
{
get{return this._UserLogs;}
}
{
set {this._UserLogs.Assign(value);
}
自動生成されたコードを変更せずに (Moq を使用して) UserLog.UserProfile をモックするにはどうすればよいですか?
私がやりたいことは次のようなものです:
var mockUserLog = new Mock<UserLog>();
mockUserLog.Setup(c=>c.UserProfile.FirstName).Returns("Fred");
等
これは、designer.cs にアクセスして FirstName と UserProfile を仮想化すれば実行できますが、部分クラスで実行したいと考えています。
何か案は?
ありがとうジェレミー