本文整理汇总了C#中ISession.Stub方法的典型用法代码示例。如果您正苦于以下问题:C# ISession.Stub方法的具体用法?C# ISession.Stub怎么用?C# ISession.Stub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISession
的用法示例。
在下文中一共展示了ISession.Stub方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Context
public void Context()
{
_session = MockRepository.GenerateMock<ISession>();
_session.Stub(x => x.Save(Arg<object>.Is.NotNull))
.WhenCalled(x => _saved.Add(x.Arguments.First()));
var container = IoC.Container;
container.Configure(x => x.For<ISession>().Use(_session));
var eventAggregator = new EventAggregator(container);
eventAggregator.Publish(new SubscriptionCreated());
}
示例2: SetUp
public void SetUp()
{
_sessionFactory = MockRepository.GenerateMock<ISessionFactory>();
_session = MockRepository.GenerateStub<ISession>();
_transaction = MockRepository.GenerateStub<ITransaction>();
_sessionFactory.Expect(x => x.OpenSession()).Return(_session);
_session.Stub(x => x.BeginTransaction()).Return(_transaction);
_sessionContainer = new SessionContainer(_sessionFactory);
}
示例3: establish_context
public override void establish_context()
{
var property = ReflectionHelper.GetAccessor((Expression<Func<ReferenceEntity, object>>)(x => x.ReferenceList));
referencedEntities = new List<OtherEntity> {new OtherEntity(), new OtherEntity()};
session = MockRepository.GenerateStub<ISession>();
session.Stub(x => x.BeginTransaction()).Return(MockRepository.GenerateStub<ITransaction>());
specification = new PersistenceSpecification<PropertyEntity>(session);
sut = new ReferenceList<PropertyEntity, OtherEntity>(property, referencedEntities);
}
示例4: Setup
public void Setup()
{
sessionManagerFactory = MockRepository.GenerateStub<ISessionManagerFactory>();
sessionManager = MockRepository.GenerateStub<ISessionManager>();
session = MockRepository.GenerateStub<ISession>();
transaction = MockRepository.GenerateStub<ITransaction>();
sessionManagerFactory.Stub(x => x.Resolve()).Return(sessionManager).Repeat.Any();
sessionManager.Stub(s => s.OpenSession()).Return(session).Repeat.Any();
session.Stub(s => s.BeginTransaction()).Return(transaction).Repeat.Any();
var perActionTransactionStore = new MockPerActionTransactionStore();
filter = new UnitOfWorkFilter(perActionTransactionStore, sessionManagerFactory);
}
示例5: Setup
public void Setup()
{
var firstKitten = new Kitten { Id = 1, Name = "Kitten" };
_cat = new Cat
{
Id = 100,
Name = "Cat",
FirstKitten = firstKitten,
Picture = new Bitmap(5, 5),
AllKittens = new List<Kitten>
{
firstKitten,
new Kitten {Id = 2, Name = "Kitten2"},
}
};
firstKitten = new Kitten { Id = 1, Name = "IdenticalKitten" };
_identicalCat = new Cat
{
Id = 100,
Name = "IdenticalCat",
FirstKitten = firstKitten,
Picture = new Bitmap(5, 5),
AllKittens = new List<Kitten>
{
firstKitten,
new Kitten {Id = 2, Name = "IdenticalKitten2"},
}
};
_transaction = MockRepository.GenerateStub<ITransaction>();
_session = MockRepository.GenerateStub<ISession>();
_session.Stub(s => s.BeginTransaction()).Return(_transaction);
_session.Stub(s => s.Get<Cat>(null)).IgnoreArguments().Return(_identicalCat);
_session.Stub(s => s.GetIdentifier(_cat)).Return(_cat.Id);
_sessionSource = MockRepository.GenerateStub<ISessionSource>();
_sessionSource.Stub(ss => ss.CreateSession()).Return(_session);
_spec = new PersistenceSpecification<Cat>(_sessionSource, new TestComparer());
}
示例6: Setup
public void Setup()
{
_session = MockRepository.GenerateStub<ISession>();
_session.Stub(x => x.Get<List<Uri>>(Session.CombatantImages)).Return(new List<Uri> {new Uri("ftp://foo"), new Uri("http://bar"), new Uri("http://foobar")});
_target = new ConfigViewModel(_session, new EventAggregator());
}
示例7: SetUp
public void SetUp()
{
_nHibernateSessionFactory = MockRepository.GenerateStub<INHibernateSessionFactory>();
_session = MockRepository.GenerateMock<ISession>();
_transaction = MockRepository.GenerateStub<ITransaction>();
_nHibernateSessionFactory.Stub(s => s.CreateSession()).Return(_session);
_session.Stub(s => s.BeginTransaction()).Return(_transaction);
_uow = new NHibernateUnitOfWork(_nHibernateSessionFactory);
_uow.Initialize();
}