예제 #1
0
        public void Test06_Attempt_To_Commit_Changes_For_ReadOnly_DbContext()
        {
            var dbContextCollection = new DbContextCollection(true);
            var dbContext           = dbContextCollection.Get <FakeDbContext>();
            var commitedChanges     = dbContextCollection.Commit();

            dbContext.Should().NotBeNull();
            commitedChanges.Should().Be(0);
        }
예제 #2
0
        public void Test05_Attempt_To_Commit_Changes_On_One_DbContext()
        {
            var dbContextCollection = new DbContextCollection();
            var dbContext           = dbContextCollection.Get <FakeDbContext>();
            var commitedChanges     = dbContextCollection.Commit();

            dbContext.Should().NotBeNull();
            commitedChanges.Should().Be(2);
        }
예제 #3
0
        public void Test04_Attempt_To_Commit_Changes_On_Two_DbContexts()
        {
            var dbContextCollection = new DbContextCollection();
            var dbContext1          = dbContextCollection.Get <FakeDbContext>();
            var dbContext2          = dbContextCollection.Get <AnotherFakeDbContext>();
            var commitedChanges     = dbContextCollection.Commit();

            dbContext1.Should().NotBeNull();
            dbContext2.Should().NotBeNull();
            dbContext1.InstanceId.Should().NotBe(dbContext2.InstanceId);
            commitedChanges.Should().Be(3);
        }
예제 #4
0
 private int CommitInternal()
 {
     return(_dbContexts.Commit());
 }
예제 #5
0
 /// <summary>
 /// Commit all transaction.
 /// </summary>
 internal void Commit()
 {
     DbContextCollection.Commit();
 }