Esempio n. 1
0
        public void GetRecentMetas_Should()
        {
            var repo = new ReplayRepo(true);

            var metas = repo.GetRecentMetas();

            Assert.That(metas[0].Timestamp > metas[1].Timestamp);
        }
Esempio n. 2
0
        public void SaveReplay_ShouldSave()
        {
            var repo = new ReplayRepo(true);
            var meta = CreateReplayMeta();
            var map  = MapLoader.LoadMap(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\..\..\maps\oxford2.json")).Map;

            JsonConvert.SerializeObject(map).CalculateMd5();
            var data = new ReplayData(map, Enumerable.Range(0, map.Rivers.Length).Select(i => Move.Claim(0, i, i + 1)).ToArray(), new Future[0]);
            var sw   = Stopwatch.StartNew();

            repo.SaveReplay(meta, data);
            Console.WriteLine(sw.Elapsed);
            sw.Restart();
            var savedData = repo.GetData(meta);

            Console.WriteLine(sw.Elapsed);
            Assert.NotNull(savedData);
        }