Ejemplo n.º 1
0
        public async Task CommitRollbackUnitOfWork1()
        {
            var unitOfWork = new InmemoryUnitOfWork();
            var set        = await unitOfWork.CreateSet <Account>();

            var account = new Account {
                Email = this.UniqueEmail, Name = "misha"
            };

            account.EnsureIdentity();

            set.Add(account.Id, account);

            await unitOfWork.Commit();

            var set1 = await unitOfWork.CreateSet <Account>();

            var count = set1.Count;

            var account1 = new Account {
                Email = this.UniqueEmail, Name = "misha"
            };

            account1.EnsureIdentity();

            set1.Add(account1.Id, account1);

            await unitOfWork.Rollback();

            var set3 = await unitOfWork.CreateSet <Account>();

            Assert.AreEqual(count, set3.Count);
        }
Ejemplo n.º 2
0
        public async Task TestByRelationsUnitOfWork()
        {
            var unitOfWork = new InmemoryUnitOfWork();
            var set        = await unitOfWork.CreateSet <Account>();

            var set2 = await unitOfWork.CreateSet <Account>();

            var account = new Account();

            account.EnsureIdentity();

            set.Add(account.Id, account);

            Assert.AreEqual(set2.Count, set.Count);
        }
Ejemplo n.º 3
0
        public async Task CreateUnitOfWork()
        {
            var unitOfWork = new InmemoryUnitOfWork();
            var set        = await unitOfWork.CreateSet <Account>();

            Assert.IsNotNull(set);
        }
Ejemplo n.º 4
0
        public async Task FillByOneTypeUnitOfWork()
        {
            var unitOfWork = new InmemoryUnitOfWork();
            var set        = await unitOfWork.CreateSet <Account>();

            var account = new Account();

            account.EnsureIdentity();

            set.Add(account.Id, account);

            Assert.AreEqual(1, set.Count);
        }
Ejemplo n.º 5
0
        public async Task CommitByRelationsUnitOfWork()
        {
            var unitOfWork = new InmemoryUnitOfWork();
            var set        = await unitOfWork.CreateSet <Account>();

            var account = new Account {
                Email = this.UniqueEmail, Name = "misha"
            };

            account.EnsureIdentity();

            set.Add(account.Id, account);

            var count = set.Count;

            await unitOfWork.Commit();

            Assert.AreEqual(count, set.Count);
        }