public void TestSerializeDemographic()
 {
     Demographic demographic = new Demographic(20, Categories.Food, 10, 8, 1);
     Serializer serializer = new Serializer();
     string json = serializer.Serialize(demographic);
     Assert.IsTrue(json.Contains("\"rank\":1"));
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.Title = "CivStats";
            if (!IsUpToDate())
            {
                Console.Write("This app needs to be updated. Please update the app.");
                Console.ReadKey();
                return;
            }

            CheckSettings();

            id = Properties.Settings.Default.id;
            key = Properties.Settings.Default.key;
            serializer = new Serializer();

            IStatsTracker[] trackers = {
                new GameTracker(),
                new DemographicsTracker(),
                new PolicyChoicesTracker(),
                new ReligionTracker(),
                new WondersTracker(),
                new WarEventsTracker(),
                new NaturalWondersTracker()
            };

            string baseUrl = SiteUrl + "players/" + id;
            TrackerUriMap = new Dictionary<Type, Uri>
            {
                { typeof(GameTracker), new Uri(baseUrl + "/games") },
                { typeof(DemographicsTracker), new Uri(baseUrl + "/demographics") },
                { typeof(PolicyChoicesTracker), new Uri(baseUrl + "/policies") },
                { typeof(ReligionTracker), new Uri(baseUrl + "/religions") },
                { typeof(WondersTracker), new Uri(baseUrl + "/wonders") },
                { typeof(WarEventsTracker), new Uri(baseUrl + "/wars") },
                { typeof(NaturalWondersTracker), new Uri(baseUrl + "/wonders") },
            };

            foreach (IStatsTracker tracker in trackers)
            {
                tracker.Changed += StatsTrackerChangedHandler;
            }

            Console.WriteLine("Reporting civ stats. Please exit after you've finished playing.");
            Console.ReadKey();
        }