public void Setup()
        {
            var transaction = MockRepository.GenerateStub<ITransaction>();
            var session = MockRepository.GenerateStub<ISession>();
            session.Stub(s => s.BeginTransaction()).Return(transaction);

            sessionSource = MockRepository.GenerateStub<ISessionSource>();
            sessionSource.Stub(ss => ss.CreateSession()).Return(session);
        }
Пример #2
0
        public void Setup()
        {
            var transaction = MockRepository.GenerateStub <ITransaction>();
            var session     = MockRepository.GenerateStub <ISession>();

            session.Stub(s => s.BeginTransaction()).Return(transaction);

            sessionSource = MockRepository.GenerateStub <ISessionSource>();
            sessionSource.Stub(ss => ss.CreateSession()).Return(session);
        }
Пример #3
0
        public void SetUp()
        {
            _sessionSource = MockRepository.GenerateStub <ISessionSource>();
            _session       = MockRepository.GenerateMock <ISession>();
            _transaction   = MockRepository.GenerateStub <ITransaction>();

            _sessionSource.Stub(s => s.CreateSession()).Return(_session);
            _session.Stub(s => s.BeginTransaction()).Return(_transaction);

            _uow = new NHibernateUnitOfWork(_sessionSource);
            _uow.Initialize();
        }
Пример #4
0
        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());
        }
        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());
        }
        public void SetUp()
        {
            _sessionSource = MockRepository.GenerateStub<ISessionSource>();
            _session = MockRepository.GenerateMock<ISession>();
            _transaction = MockRepository.GenerateStub<ITransaction>();

            _sessionSource.Stub(s => s.CreateSession()).Return(_session);
            _session.Stub(s => s.BeginTransaction()).Return(_transaction);

            _uow = new NHibernateUnitOfWork(_sessionSource);
            _uow.Initialize();
        }