当前位置: 首页>>代码示例>>C#>>正文


C# ISession.Stub方法代码示例

本文整理汇总了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());
        }
开发者ID:mattiasbrand,项目名称:InProcessEventAggregator,代码行数:11,代码来源:EventAggregatorTests.cs

示例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);
            }
开发者ID:RitsukoO,项目名称:sampleprojects,代码行数:11,代码来源:SessionContainerTests.cs

示例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);
        }
开发者ID:garrisonx,项目名称:NH3BegginnersGuide,代码行数:12,代码来源:ReferenceListSpecs.cs

示例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);
		}
开发者ID:somlea-george,项目名称:sutekishop,代码行数:15,代码来源:UnitOfWorkFilterTester.cs

示例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());
        }
开发者ID:ebnovaes,项目名称:fluent-nhibernate,代码行数:42,代码来源:PersistenceSpecificationTester.cs

示例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());
 }
开发者ID:PapaMufflon,项目名称:CodingDojoHelper,代码行数:6,代码来源:ConfigViewModelTests.cs

示例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();
        }
开发者ID:Anupam-,项目名称:fubumvc-contrib,代码行数:12,代码来源:NHibernateUnitOfWorkTester.cs


注:本文中的ISession.Stub方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。