コード例 #1
0
        public void ShouldNotCacheEventsSavedDuringFailedTransactionEvenIfReadDuringSameTransaction()
        {
            var something = new SqlServerEventStore(ConfigurationManager.ConnectionStrings["EventStore"].ConnectionString);
            something.ResetDB();//Sometimes the test would fail on the last line with information that the table was missing. Probably because the table was created during the aborted transaction. I'm hoping this will fix it.

            var user = new User();
            user.Register("*****@*****.**", "password", Guid.NewGuid());

            using (new TransactionScope())
            {
                something.SaveEvents(((IEventStored) user).GetChanges());
                something.GetAggregateHistory(user.Id);
                Assert.That(something.GetAggregateHistory(user.Id), Is.Not.Empty);
            }

            Assert.That(something.GetAggregateHistory(user.Id), Is.Empty);
        }
コード例 #2
0
 public static void ResetDB(string connectionString)
 {
     using (var session = new SqlServerEventStore(connectionString))
     {
         session.ResetDB();
     }
 }