Ejemplo n.º 1
0
        public void TestSaveGameDataWithStaticData()
        {
            string compressedXml = GetCompressedGameDataXml();

            ACSSAuth.Server.Tag tag = new ACSSAuth.Server.Tag();

            string message;
            int    result = tag.SaveGameData(compressedXml, out message);

            Assert.IsTrue(result > 0, message);
        }
Ejemplo n.º 2
0
        public void TestSaveGameDataWithGameXmlFiles()
        {
            Console.WriteLine("Processing: " + ConfigurationManager.AppSettings["gameTestDataDirectory"]);

            // Increase this to simulate multiple game file loads. Takes a long time for each load.
            for (int i = 0; i < 1; i++)
            {
                Console.WriteLine("Creating TAG object.");

                ACSSAuth.Server.Tag tag = new ACSSAuth.Server.Tag();

                using (DataAccess.CSSDataContext db = new ACSSAuth.DataAccess.CSSDataContext())
                {
                    Console.WriteLine("Looking for files.");

                    foreach (string file in Directory.GetFiles(ConfigurationManager.AppSettings["gameTestDataDirectory"], ConfigurationManager.AppSettings["gameTestDataFileFilter"]))
                    {
                        Console.WriteLine("Loading: " + file);

                        string      gameData    = File.ReadAllText(file);
                        GameDataset gameDataset = new GameDataset();
                        gameDataset.ReadXml(new StringReader(gameData), System.Data.XmlReadMode.IgnoreSchema);

                        foreach (GameDataset.TeamRow team in gameDataset.Team)
                        {
                            var alias = DataAccess.Alias.GetAliasByCallsign(db, team.Commander);

                            if (alias == null)
                            {
                                CreateUser(DataAccess.Alias.GetCallsignFromStringWithTokensAndTags(db, team.Commander), "test12", "*****@*****.**", 10);
                            }
                        }

                        foreach (GameDataset.TeamMemberRow teamMember in gameDataset.TeamMember)
                        {
                            var alias = DataAccess.Alias.GetAliasByCallsign(db, teamMember.Callsign);

                            if (alias == null)
                            {
                                CreateUser(DataAccess.Alias.GetCallsignFromStringWithTokensAndTags(db, teamMember.Callsign), "test12", "*****@*****.**", 20);
                            }
                        }


                        string message;
                        int    result = tag.SaveGameData(gameData, false, out message);

                        Assert.IsTrue(result > 0, message);
                    }
                }
            }
        }