示例#1
0
        public void SaveAndRetrieveUserStatistics()
        {
            using (var ts = new TransactionScope())
            {
                var repository = new StatisticsRepository(ConnectionString);

                var stats = new UserStats()
                {
                    UserId    = "testuser",
                    GameCount = 10,
                    Victories = 5,
                    Defeats   = 1
                };

                repository.Save(stats);

                var result = repository.Retrieve(stats.UserId);

                Assert.AreEqual(result.UserId, stats.UserId);
                Assert.AreEqual(result.GameCount, stats.GameCount);
                Assert.AreEqual(result.Victories, stats.Victories);
                Assert.AreEqual(result.Defeats, stats.Defeats);
            }
        }
示例#2
0
 public void CreateDatabase()
 {
     // Code for creating the database if it does not exists
     var repository = new StatisticsRepository(ConnectionString);
     var result     = repository.Retrieve(Guid.NewGuid().ToString());
 }