Exemple #1
0
        public async Task CanCommitChanges()
        {
            await _unitOfWork.Begin();

            var id = (int)await _connection.InsertAsync(new Token()
            {
                TokenGuid     = Guid.NewGuid(),
                CreatedAt     = DateTime.Now,
                LastRequestAt = DateTime.Now,
                UserId        = 1
            });

            await _unitOfWork.Commit();

            var token = await _connection.GetAsync <Token>(id);

            Assert.NotNull(token);
        }
Exemple #2
0
        public void CanSaveSaga()
        {
            uow.Begin();
            persister.Save(saga);
            uow.End();

            using (var context = new SagaContext())
            {
                var sagaData = context.SagaData.FirstOrDefault(s => s.Id == saga.Id);
                context.SagaData.Remove(sagaData);
                context.SaveChanges();

                Assert.IsNotNull(sagaData);
                Assert.IsNotNull(sagaData.Data);
                Assert.IsNotNull(sagaData.UniqueProperty);
                Assert.AreEqual(1, sagaData.Version);
            }
        }