Mercurial > repos > IBDev-IBBoard.WarFoundry.API.Tests
view API/Savers/Xml/WarFoundryXmlFileSaverTests.cs @ 239:370bec16a364 default tip
Add initial testing for equipment with type (incomplete)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 16 Oct 2016 20:29:35 +0100 |
parents | 32b3e41bc8f0 |
children |
line wrap: on
line source
using System; using NUnit.Framework; using System.IO; using IBBoard.WarFoundry.API.Objects; using IBBoard.Lang; namespace IBBoard.WarFoundry.API.Savers.Xml { [TestFixture()] public class WarFoundryXmlFileSaverTests : IWarFoundryFileSaverTests { protected override IWarFoundryFileSaver GetSaver() { return new WarFoundryXmlFileSaver(); } protected override string GetEntryName(WarFoundryLoadedObject obj) { return obj.ID + GetFileExtensionForType(obj); } protected override string GetFileExtensionForType(WarFoundryLoadedObject obj) { return GetSaver().GetFileExtension(obj); } protected override string GetArmyExtension() { return ".armyx"; } protected override string GetRaceExtension() { return ".racex"; } protected override string GetGameSystemExtension() { return ".systemx"; } protected override byte[] GetGameSystemContentBytes() { return StringManipulation.StringToBytes(@"<?xml version=""1.0"" encoding=""UTF-8""?><system xmlns=""http://ibboard.co.uk/warfoundry/system"" xmlns:cats=""http://ibboard.co.uk/warfoundry/cats"" id=""mocksystem"" name=""Mock Game System"" defaultArmySize=""1000"" warn=""true"" allowAllies=""false"" defaultPtsAbbreviationSingular="""" defaultPtsAbbreviationPlural="""" defaultPtsNameSingular="""" defaultPtsNamePlural=""""><categories /><sysStatsList defaultStats=""default""><sysStats id=""default"" /></sysStatsList></system>"); } protected override byte[] GetOtherGameSystemContentBytes() { return StringManipulation.StringToBytes(@"<?xml version=""1.0"" encoding=""UTF-8""?><system xmlns=""http://ibboard.co.uk/warfoundry/system"" xmlns:cats=""http://ibboard.co.uk/warfoundry/cats"" id=""otherSystem"" name=""Other System"" defaultArmySize=""2000"" warn=""false"" allowAllies=""true"" defaultPtsAbbreviationSingular="""" defaultPtsAbbreviationPlural="""" defaultPtsNameSingular="""" defaultPtsNamePlural=""""><categories /><sysStatsList defaultStats=""_"" /></system>"); } protected override byte[] GetArmyContentBytes() { return StringManipulation.StringToBytes(@"<?xml version=""1.0"" encoding=""UTF-8""?><army xmlns=""http://ibboard.co.uk/warfoundry/army"" xmlns:core=""http://ibboard.co.uk/warfoundry/core"" id=""MockArmy"" name=""Mock Army"" system=""mocksystem"" race=""mockrace"" maxPoints=""2000""><units /></army>"); } protected override byte[] GetGameSystemContentWithPointsAbbrevsBytes(string singular, string plural) { return StringManipulation.StringToBytes(@"<?xml version=""1.0"" encoding=""UTF-8""?><system xmlns=""http://ibboard.co.uk/warfoundry/system"" xmlns:cats=""http://ibboard.co.uk/warfoundry/cats"" id=""mocksystem"" name=""Mock Game System"" defaultArmySize=""1000"" warn=""true"" allowAllies=""false"" defaultPtsAbbreviationSingular=""" + singular + @""" defaultPtsAbbreviationPlural=""" + plural + @""" defaultPtsNameSingular="""" defaultPtsNamePlural=""""><categories /><sysStatsList defaultStats=""default""><sysStats id=""default"" /></sysStatsList></system>"); } protected override byte[] GetGameSystemContentWithPointsNameBytes(string singular, string plural) { return StringManipulation.StringToBytes(@"<?xml version=""1.0"" encoding=""UTF-8""?><system xmlns=""http://ibboard.co.uk/warfoundry/system"" xmlns:cats=""http://ibboard.co.uk/warfoundry/cats"" id=""mocksystem"" name=""Mock Game System"" defaultArmySize=""1000"" warn=""true"" allowAllies=""false"" defaultPtsAbbreviationSingular="""" defaultPtsAbbreviationPlural="""" defaultPtsNameSingular=""" + singular + @""" defaultPtsNamePlural=""" + plural + @"""><categories /><sysStatsList defaultStats=""default""><sysStats id=""default"" /></sysStatsList></system>"); } protected override byte[] GetGameSystemContentWithPointsAbbrevsAndNameBytes(string singular, string plural, string singularName, string pluralName) { return StringManipulation.StringToBytes(@"<?xml version=""1.0"" encoding=""UTF-8""?><system xmlns=""http://ibboard.co.uk/warfoundry/system"" xmlns:cats=""http://ibboard.co.uk/warfoundry/cats"" id=""mocksystem"" name=""Mock Game System"" defaultArmySize=""1000"" warn=""true"" allowAllies=""false"" defaultPtsAbbreviationSingular=""" + singular + @""" defaultPtsAbbreviationPlural=""" + plural + @""" defaultPtsNameSingular=""" + singularName + @""" defaultPtsNamePlural=""" + pluralName + @"""><categories /><sysStatsList defaultStats=""default""><sysStats id=""default"" /></sysStatsList></system>"); } protected override byte[] GetGameSystemContentWithCategories() { return StringManipulation.StringToBytes(@"<?xml version=""1.0"" encoding=""UTF-8""?><system xmlns=""http://ibboard.co.uk/warfoundry/system"" xmlns:cats=""http://ibboard.co.uk/warfoundry/cats"" id=""mocksystem"" name=""Mock Game System"" defaultArmySize=""1000"" warn=""true"" allowAllies=""false"" defaultPtsAbbreviationSingular="""" defaultPtsAbbreviationPlural="""" defaultPtsNameSingular="""" defaultPtsNamePlural=""""><categories><cat id=""cat1"" name=""Heroes"" maxPoints=""1000"" maxPercentage=""25"" /><cat id=""cat2"" name=""Warriors"" minPoints=""500"" minPercentage=""35"" /></categories><sysStatsList defaultStats=""default""><sysStats id=""default"" /></sysStatsList></system>"); } protected override byte[] GetGameSystemContentWithStats() { return StringManipulation.StringToBytes(@"<?xml version=""1.0"" encoding=""UTF-8""?><system xmlns=""http://ibboard.co.uk/warfoundry/system"" xmlns:cats=""http://ibboard.co.uk/warfoundry/cats"" id=""mocksystem"" name=""Mock Game System"" defaultArmySize=""1000"" warn=""true"" allowAllies=""false"" defaultPtsAbbreviationSingular="""" defaultPtsAbbreviationPlural="""" defaultPtsNameSingular="""" defaultPtsNamePlural=""""><categories /><sysStatsList defaultStats=""stats""><sysStats id=""default"" /><sysStats id=""stats""><sysStat name=""M"" /><sysStat name=""S"" /><sysStat name=""T"" /><sysStat name=""W"" /></sysStats></sysStatsList></system>"); } } }