本文整理汇总了C#中RepositoryFactory.GetUserRepository方法的典型用法代码示例。如果您正苦于以下问题:C# RepositoryFactory.GetUserRepository方法的具体用法?C# RepositoryFactory.GetUserRepository怎么用?C# RepositoryFactory.GetUserRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RepositoryFactory
的用法示例。
在下文中一共展示了RepositoryFactory.GetUserRepository方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Setup
public void Setup()
{
//RepositoryFactory is public... should that be the casE?
//Uhh... crap, maybe that is okay because you would need to DLL to get it I believe
//obivously it doesn't get exposed as part of the service. Well wtf am I so concerned about then...
//well, stuff should be limited as much as possible
//I'm able to hide the repos outside of the assembly, which forces the use of the factory
//Its fine if the factory is public imo... use that to get all these repos, use those for testing
//the data access layer part of the service
//testing the Service Access layer should be easy... those methods should pretty much all be public or just use reflection
repositoryFactory = new RepositoryFactory(configString);
Assert.NotNull(repositoryFactory);
userRepo = repositoryFactory.GetUserRepository(false);
Assert.NotNull(userRepo);
mockUserRepo = repositoryFactory.GetUserRepository(true); //This returns a test repo that doesn't hit the database
Assert.NotNull(mockUserRepo);
// Assert.IsInstanceOf(typeof(UserRepository), userRepo);
}
示例2: Setup
public void Setup()
{
repositoryFactory = new RepositoryFactory(configString);
Assert.NotNull(repositoryFactory);
userRepo = repositoryFactory.GetUserRepository(false);
Assert.NotNull(userRepo);
fileRepo = repositoryFactory.GetFileRepository(false); //Need to use the existing DataContext for this test already setup in UserRepository
Assert.NotNull(fileRepo);
downloadHistoryRepo = repositoryFactory.GetDownloadHistoryRepository(false); //Need to use the existing DataContext for this test already setup in UserRepository
Assert.NotNull(downloadHistoryRepo);
mockDownloadHistoryRepo = repositoryFactory.GetDownloadHistoryRepository(true); //This returns a test repo that doesn't hit the database
Assert.NotNull(mockDownloadHistoryRepo);
}