Beispiel #1
0
        public void BindTheSessionToTheCurrentSessionContext()
        {
            IsolateRepository();

            RepositoryFixture.CreateInMemorySqLiteRepository <TestMapping>("Test");
            Isolate.Verify.WasCalledWithAnyArguments(() => CurrentSessionContext.Bind(_session));
        }
Beispiel #2
0
        public void PassTheConnectionToTheGetSessionMethodOfTheSessionFactory()
        {
            IsolateRepository();

            RepositoryFixture.CreateInMemorySqLiteRepository <TestMapping>("Test");
            Isolate.Verify.WasCalledWithExactArguments(() => _factory.OpenSession(_connection));
        }
Beispiel #3
0
        public void UseTheReturnedEnvironmentConfigToGetTheSessionFactory()
        {
            IsolateRepository();

            RepositoryFixture.CreateInMemorySqLiteRepository <TestMapping>("Test");
            Isolate.Verify.WasCalledWithAnyArguments(() => _envConfig.GetSessionFactory());
        }
Beispiel #4
0
        public void Init()
        {
            InitCache();

            _confMan = ConfigurationManager.Instance;
            Isolate.WhenCalled(() => _confMan.AddInMemorySqLiteEnvironment <TestMapping>("Test")).CallOriginal();
            RepositoryFixture.CreateInMemorySqLiteRepository <TestMapping>("Test");
        }
Beispiel #5
0
        public void ThatEntityCanBeIdentifiedByAnId()
        {
            var repos = RepositoryFixture.CreateInMemorySqLiteRepository <TestMapping>("test");
            var ent   = EntityFixture.CreateIntIdEntity();

            repos.Add(ent);

            Assert.AreEqual(ent, repos.First(e => e.Id.Equals(ent.Id)));
        }
Beispiel #6
0
        public void ThatEntityCanBeIdentitiedByItsIdentiy()
        {
            var ent = EntityFixture.CreateEntityWithId(1);

            ent.Name = "TestEntity";
            var repos = RepositoryFixture.CreateInMemorySqLiteRepository <TestMapping>("test");

            repos.Add(ent);

            Assert.AreEqual(ent, repos.SingleOrDefault(e => e.IsIdentical(ent)));
        }