本文整理汇总了C#中RepositoryFactory.Create方法的典型用法代码示例。如果您正苦于以下问题:C# RepositoryFactory.Create方法的具体用法?C# RepositoryFactory.Create怎么用?C# RepositoryFactory.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RepositoryFactory
的用法示例。
在下文中一共展示了RepositoryFactory.Create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: should_create_repository
public void should_create_repository()
{
var mockFactory = new FakeMongoDatabaseFactory();
var sut = new RepositoryFactory(mockFactory);
var result = sut.Create<User>(new RepositoryOptions("lorem", "ipsum", "users"));
result.Should().NotBeNull();
result.CollectionName.ShouldBeEquivalentTo("users");
}
示例2: ShouldCreateSimpleRepositoryWithContextNoLog
public void ShouldCreateSimpleRepositoryWithContextNoLog()
{
//Arrange
var testDomain = new TestDomain();
IRepositoryFactory factory = new RepositoryFactory(testDomain.ConnectionString, testDomain.Mappings, testDomain.Context);
//Act
IRepository repo = factory.Create();
// assert
repo.Should().NotBeNull();
}
示例3: Should_Get_Mappings_Specific_To_The_Type_Requested
public void Should_Get_Mappings_Specific_To_The_Type_Requested()
{
//Arrange
Func<Type, IMappingConfiguration> mappingsDelegate = x =>
{
if (x == typeof (Foo)) return fooMapping;
return null;
};
var target = new RepositoryFactory(Settings.Default.Connection, mappingsDelegate);
//Act
var repository = target.Create<Foo>();
try
{
repository.Context.AsQueryable<Foo>().ToList();
}
catch (Exception)
{
//Suppress the error from the context. This allows us to test the mappings peice without having to actually map.
}
//Assert
fooMapping.VerifyAllExpectations();
}