本文整理汇总了C#中IUnitOfWork.Stub方法的典型用法代码示例。如果您正苦于以下问题:C# IUnitOfWork.Stub方法的具体用法?C# IUnitOfWork.Stub怎么用?C# IUnitOfWork.Stub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUnitOfWork
的用法示例。
在下文中一共展示了IUnitOfWork.Stub方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Setup
public void Setup()
{
_unitOfWorkFactory = MockRepository.GenerateStub<IUnitOfWorkFactory>();
_unitOfWork = MockRepository.GenerateStub<IUnitOfWork>();
_repository = MockRepository.GenerateStub<IRepository<Category>>();
_mapper = MockRepository.GenerateStub<IMapper<Category, CategoryViewModel>>();
_unitOfWorkFactory.Stub(x => x.Create()).Return(_unitOfWork);
_unitOfWork.Stub(x => x.GetRepository<Category>()).Return(_repository);
_unitOfWork.Stub(x => x.Execute(Arg<Action>.Is.Anything)).WhenCalled(x => ((Action)x.Arguments[0])());
}
示例2: SetUp
public void SetUp()
{
_session = MockRepository.GenerateMock<ISession>();
_unitOfWork = MockRepository.GenerateMock<IUnitOfWork>();
_unitOfWork.Stub(x => x.Session).Return(_session).Repeat.Any();
}
示例3: Setup
public void Setup()
{
_routeCreator = MockRepository.GenerateStub<IRouteCreator>();
_heightMapImageBuilder = MockRepository.GenerateStub<IHeightMapImageBuilder>();
_heightMapImageCache = MockRepository.GenerateStub<IHeightMapImageCache>();
_geographicRouteLocator = MockRepository.GenerateStub<IGeographicRouteLocator>();
_routeToRouteResultMapper = MockRepository.GenerateStub<IRouteToRouteResultMapper>();
_unitOfWork = MockRepository.GenerateStub<IUnitOfWork>();
_sortSecurity = MockRepository.GenerateStub<ISortSecurity>();
_routeFileCreator = MockRepository.GenerateStub<IRouteFileCreator>();
_routeRepository = MockRepository.GenerateStub<IRepository<Route>>();
_unitOfWork.Stub(s => s.GetRepository<Route>()).Return(_routeRepository);
_routeService = new RouteService(_routeCreator,
_heightMapImageBuilder,
_heightMapImageCache,
_geographicRouteLocator,
_routeToRouteResultMapper,
_unitOfWork,
_sortSecurity,
_routeFileCreator);
}
示例4: Setup
public void Setup()
{
_category1 = new Category {CategoryID = 1};
_category2 = new Category {CategoryID = 2};
_post1 = new Post { PostID = 1, PostedAt = DateTime.Now.Subtract(TimeSpan.FromDays(50)), Categories = new Collection<Category>{_category1}};
_post2 = new Post { PostID = 2, PostedAt = DateTime.Now, Categories = new Collection<Category>{ _category2}};
List<Post> posts = new List<Post> { _post1, _post2 };
_unitOfWorkFactory = MockRepository.GenerateStub<IUnitOfWorkFactory>();
_unitOfWork = MockRepository.GenerateStub<IUnitOfWork>();
_postRepository = MockRepository.GenerateStub<IRepository<Post>>();
_mapper = MockRepository.GenerateStub<IMapper<Post, PostViewModel>>();
_unitOfWorkFactory.Stub(x => x.Create()).Return(_unitOfWork);
_unitOfWork.Stub(x => x.GetRepository<Post>()).Return(_postRepository);
_unitOfWork.Stub(x => x.Execute(Arg<Action>.Is.Anything)).WhenCalled(x => ((Action)x.Arguments[0])());
_postRepository.Stub(y => y.AllIncluding(Arg<Expression<Func<Post, object>>>.Is.Anything)).Return(posts.AsQueryable());
}