public void Can_Determine_If_Entity_Is_Deleted()
        {
            var unitOfWork = _factory.CreateUnitOfWork();

              using (unitOfWork.Start())
            {
            var uow = (TestUnitOfWork)unitOfWork;
            var repository = uow.Persons;

            var entity = new Person
            {
              Name = "Mark Mohr",
              Birthdate = new DateTime(1963, 6, 11)
            };

            repository.Add(entity);
            unitOfWork.TransactionalFlush();

            // ReSharper disable RedundantAssignment
            var state = repository.GetState(entity);
            // ReSharper restore RedundantAssignment

            repository.Remove(entity);

            state = repository.GetState(entity);

            Assert.IsTrue(state == EntityState.Deleted);

            unitOfWork.TransactionalFlush();
            }
        }
 public void Can_Add_A_New_Instance_Of_An_Entity_To_The_Database()
 {
     var unitOfWork = _factory.CreateUnitOfWork();
       using (unitOfWork.Start())
     {
     var person = new Person { Name = "John Doe", Birthdate = new DateTime(1915, 12, 15) };
     unitOfWork.Session.Save(person);
     unitOfWork.TransactionalFlush();
     }
 }
        public void Can_Determine_If_Entity_Is_Added()
        {
            var unitOfWork = _factory.CreateUnitOfWork();

              using (unitOfWork.Start())
            {
            var uow = (TestUnitOfWork)unitOfWork;
            var repository = uow.Persons;

            var entity = new Person
              {
              Name = "Mark Mohr",
              Birthdate = new DateTime(1963, 6, 11)
              };

            repository.Add(entity);

            var state = repository.GetState(entity);

            Assert.IsTrue(state == EntityState.Added);
            }
        }