public void TestSaveGameDataWithStaticData() { string compressedXml = GetCompressedGameDataXml(); Allegiance.CommunitySecuritySystem.Server.Tag tag = new Allegiance.CommunitySecuritySystem.Server.Tag(); string message; int result = tag.SaveGameData(compressedXml, out message); Assert.IsTrue(result > 0, message); }
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."); Allegiance.CommunitySecuritySystem.Server.Tag tag = new Allegiance.CommunitySecuritySystem.Server.Tag(); using (DataAccess.CSSDataContext db = new Allegiance.CommunitySecuritySystem.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); } } } }
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."); Allegiance.CommunitySecuritySystem.Server.Tag tag = new Allegiance.CommunitySecuritySystem.Server.Tag(); using (DataAccess.CSSDataContext db = new Allegiance.CommunitySecuritySystem.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); } } } }