コード例 #1
0
        public void Can_Start_And_Finish_Operations()
        {
            var repo = new OperationRepository(Context);

            using (var transaction = Context.Database.BeginTransaction())
            {
                var op1 = repo.Start("TEST", null);

                var op2 = repo.GetCurrent();
                var op3 = repo.GetCurrent();

                var ops = new List <Operation>()
                {
                    op1, op2, op3
                };
                Assert.AreEqual(1, ops.Select(x => x.Id).Distinct().Count());

                repo.Stop(op1);

                var op4 = repo.GetCurrent();
                Assert.IsNull(op4);
                transaction.Commit();
            }

            var op5 = repo.GetCurrent();

            Assert.IsNull(op5);
        }