public void ParseFakeSendXmlFile() { const string fileName = @"..\..\..\Samples\FakeAttack\FakeAttack.xml"; ActionList actionList; using (ActionParser actionParser = new ActionParser(fileName)) { actionList = actionParser.Parse(); } Assert.IsNotNull(actionList.FakeActionList); Assert.AreEqual(3, actionList.FakeActionList.Count); }
public void ParseConfig() { FileInfo fileInfo = new FileInfo("FakeAttack.xml"); using (Stream xmlStream = File.OpenRead(fileInfo.FullName)) { actionList = new ActionList(); using (ActionParser actionParser = new ActionParser(xmlStream)) { actionList = actionParser.Parse(); } } }
public void Parse() { FileInfo fileInfo = new FileInfo("TroopSender.xml"); using (Stream xmlStream = File.OpenRead(fileInfo.FullName)) { actionList = new ActionList(); using (ActionParser actionParser = new ActionParser(xmlStream)) { actionList = actionParser.Parse(); } } }
public void ParseTroopSendXmlFile() { const string fileName = @"..\..\..\Samples\TestFiles\SendTroops.xml"; ActionList actionList; using (ActionParser actionParser = new ActionParser(fileName)) { actionList = actionParser.Parse(); } Assert.IsNotNull(actionList.TroopSenderList); Assert.AreEqual(4, actionList.TroopSenderList.Count); Assert.AreEqual("2009-01-19 20:55:02", actionList.GetTroopSenderAction("3").GetTroopSenderParameters("3").Time); }
public void NotSupportedElement() { const string xml = "<actions><action></action></actions>"; byte[] bytes = Encoding.UTF8.GetBytes(xml); using (MemoryStream stream = new MemoryStream(bytes)) { using (ActionParser actionParser = new ActionParser(stream)) { actionParser.Parse(); } } }
public void ParseAttacksXmlFile() { const string fileName = @"..\..\..\Samples\TestFiles\AttackActions.xml"; ActionList actionList; using (ActionParser actionParser = new ActionParser(fileName)) { actionList = actionParser.Parse(); } Assert.IsNotNull(actionList.ActionsList); Assert.AreEqual(4, actionList.ActionsList.Count); Assert.AreEqual( "[user3][village3][aliance3]", actionList.GetAction("3").GetActionParameters("3").Comment); }
public void Parse() { foreach (string fileName in fileNames) { using (Stream xmlStream = File.OpenRead(fileName)) { actionList = new ActionList(); using (ActionParser actionParser = new ActionParser(xmlStream)) { //Console.WriteLine("Parsing '{0}'", fileName); actionList = actionParser.Parse(); } actionContainer = new ActionContainer(); actionContainer.AddActionList(fileName, actionList); } } }
public void ParseSendResourcesXmlFile() { const string fileName = @"..\..\..\Samples\sendmerchants\ResourceSending.xml"; ActionList actionList; using (ActionParser actionParser = new ActionParser(fileName)) { actionList = actionParser.Parse(); } Assert.IsNotNull(actionList.SendResourcesList); Assert.AreEqual(3, actionList.SendResourcesList.Count); Assert.AreEqual(1111, actionList.GetSendResourcesAction("2").GetResourceSendParameters("2").WoodAmount); Assert.AreEqual(2222, actionList.GetSendResourcesAction("2").GetResourceSendParameters("2").ClayAmount); Assert.AreEqual(33, actionList.GetSendResourcesAction("1").GetResourceSendParameters("1").IronAmount); Assert.AreEqual(44444, actionList.GetSendResourcesAction("3").GetResourceSendParameters("3").CropAmount); Assert.AreEqual(0, actionList.GetSendResourcesAction("1").GetResourceSendParameters("1").DestinationVillageX); Assert.AreEqual(-1, actionList.GetSendResourcesAction("1").GetResourceSendParameters("1").DestinationVillageY); }