Esempio n. 1
0
        public void TestCreateTimes()
        {
            long firstTime    = 0;
            long firstTimeMs  = 0;
            long secondTime   = 0;
            long secondTimeMs = 0;
            var  sw           = new Stopwatch();

            sw.Start();
            StateSave <Octgn.DataNew.Entities.Game> .Create(new Octgn.DataNew.Entities.Game());

            sw.Stop();
            firstTime   = sw.ElapsedTicks;
            firstTimeMs = sw.ElapsedMilliseconds;
            sw.Reset();
            sw.Start();
            StateSave <Octgn.DataNew.Entities.Game> .Create(new Octgn.DataNew.Entities.Game());

            sw.Stop();
            secondTime   = sw.ElapsedTicks;
            secondTimeMs = sw.ElapsedMilliseconds;
            Console.WriteLine("FirstTime: " + firstTime);
            Console.WriteLine("SecondTime: " + secondTime);
            Console.WriteLine("FirstTimeMs: " + firstTimeMs);
            Console.WriteLine("SecondTimeMs: " + secondTimeMs);
            Assert.True(firstTime > secondTime);
            //Assert.LessOrEqual(firstTimeMs,1000);
            //Assert.LessOrEqual(secondTimeMs, 100);
        }
Esempio n. 2
0
        public void CreateSetsInstance()
        {
            var testList = new Octgn.DataNew.Entities.Game();

            var ss = StateSave <List <string> > .Create(testList);

            Assert.AreEqual(testList, ss.GetInstance());
        }
Esempio n. 3
0
        public void SaveLoadStateWork()
        {
            var ss = (TestStateSave)StateSave <Octgn.DataNew.Entities.Game> .Create(new Octgn.DataNew.Entities.Game());

            ss.SetData();
            ss.SaveState();
            ss.SetInstance(null);
            ss.SetInstance(new Game());
            ss.LoadState();
            ss.VerifyLoadedData();
        }
Esempio n. 4
0
        public void GetSetInstanceWorks()
        {
            var testList = new Octgn.DataNew.Entities.Game()
            {
                Name = "Chicken"
            };
            var ss = StateSave <Octgn.DataNew.Entities.Game> .Create(new Octgn.DataNew.Entities.Game());

            Assert.AreNotEqual(testList.Name, (ss.GetInstance() as Octgn.DataNew.Entities.Game).Name);
            ss.SetInstance(testList);
            Assert.AreEqual(testList, ss.GetInstance());
        }
Esempio n. 5
0
 public void CreateFailsIfNoStateSaveImplementationFound()
 {
     Assert.Throws <InvalidOperationException>(() => StateSave <Exception> .Create(new Exception()));
 }
Esempio n. 6
0
        public void CreateWorks()
        {
            var ss = StateSave <Octgn.DataNew.Entities.Game> .Create(new Octgn.DataNew.Entities.Game());

            Assert.NotNull(ss);
        }