예제 #1
0
        public void SeralizeGameCollectionGameTest()
        {
            var    gc        = GITestUtil.MakeCapcomGameCollection();
            string seralized = JsonConvert.SerializeObject(gc, Formatting.Indented);

            Console.WriteLine("Serialized object:\n{0}", seralized);
        }
예제 #2
0
        public void DescTest()
        {
            GameCollectionGame gc        = GITestUtil.MakeCapcomGameCollection();
            string             seralized = JsonConvert.SerializeObject(gc, Formatting.Indented);
            GameCollectionGame gcDes     = JsonConvert.DeserializeObject <GameCollectionGame>(seralized);

            for (int x = 0; x < gc.Count; x++)
            {
                Console.WriteLine("{0} : {1} - {2}", gc.ElementAt(x).GetType(),
                                  gcDes.ElementAt(x).GetType(),
                                  gc);
            }
        }
예제 #3
0
        public void SerializeDeserializeGameTest()
        {
            GameCollectionGame gc        = GITestUtil.MakeCapcomGameCollection();
            string             seralized = JsonConvert.SerializeObject(gc, Formatting.Indented);

            Console.WriteLine("Serialized object:\n{0}", seralized);
            GameCollectionGame gcDes       = JsonConvert.DeserializeObject <GameCollectionGame>(seralized);
            string             deseralized = JsonConvert.SerializeObject(gcDes, Formatting.Indented);

            Console.WriteLine("Deserialized object:\n{0}", deseralized);
            //Console.WriteLine(gc);
            //Console.WriteLine(gcDes);

            //var s = gcDes.Where(e => e.GetType() == typeof(PhysicalGame)).ToList();
            foreach (var g in gcDes)
            {
                Console.WriteLine(g.GetType());
            }

            for (int x = 0; x < gc.Count; x++)
            {
                // A physical Game
                GameModel g1 = (GameModel)gc.ElementAt(x);
                // a Game
                GameModel g2  = gcDes.ElementAt(x);
                GameModel g1a = g1;
                GameModel g2a = g2;


                Assert.AreEqual(g1, g1);
                Assert.AreEqual(g2, g2);
                Assert.AreEqual(g1, g1a);
                Assert.AreEqual(g2, g2a);

                if (g1 == g2)
                {
                    Console.WriteLine("equals");
                }
                else
                {
                    Console.WriteLine("notequals");
                    string gc1s = JsonConvert.SerializeObject(g1, Formatting.Indented);
                    //Console.WriteLine("Before:\n{0}", gc1s);
                    string gc2s = JsonConvert.SerializeObject(g2, Formatting.Indented);
                    //Console.WriteLine("After:\n{0}", gc2s);
                }
                Assert.AreEqual(g1, g2);
                //Assert.IsTrue(g1 == g2);
            }
        }
예제 #4
0
        public void TestGameCollectionDisplay()
        {
            var gc            = GITestUtil.MakeCapcomGameCollection();
            int digitalGames  = gc.OfType <DigitalGameModel>().Count();
            int physicalGames = gc.OfType <PhysicalGameModel>().Count();

            Console.WriteLine("{0} Digital {1} and {2} Physical {3} in \"{4}\".",
                              digitalGames,
                              (digitalGames < 2) ? "Game" : "Games",
                              physicalGames,
                              (physicalGames < 2) ? "Game" : "Games",
                              gc.Title);

            for (int x = 0; x < gc.Count; x++)
            {
                Console.WriteLine("=== Game #{0}:\n{1}===\n", x + 1, gc.ElementAt(x));
            }
        }