public void InputTemplateToAbstractConfigurationNodeCfgSerializer_Test() { var mapcol = new ControllerElementMappingProfile("Keyboard", "TEST_CONTROLLER", InputDriver.Keyboard, IDeviceEnumerator.VirtualVendorID, new XInputDeviceInstance(0).DefaultLayout); IDeviceInputMapping mapping = new TestInputMapping(); var input = new InputConfiguration <IRetroArchInput>(mapcol); var fs = new PhysicalFileSystem(); var temp = Path.GetTempPath(); var pfs = fs.GetOrCreateSubFileSystem(fs.ConvertPathFromInternal(temp)); var dir = new FS.Directory("test", pfs, pfs.GetDirectoryEntry("/")); var context = new ConfigurationTraversalContext(); var list = context.TraverseInputTemplate(input, mapping, 0); var cfgSerializer = new SimpleCfgConfigurationSerializer(); string outputCfg = cfgSerializer.Visit(list); Assert.NotEqual(string.Empty, outputCfg); // todo: test cfg parse }
public void InputTemplateToAbstractConfigurationNodeXmlSerializer_Test() { var mapcol = new ControllerElementMappingProfile("Keyboard", "TEST_CONTROLLER", InputDriver.Keyboard, IDeviceEnumerator.VirtualVendorID, new XInputDeviceInstance(0).DefaultLayout); IDeviceInputMapping mapping = new TestInputMapping(); var input = new InputTemplate <IRetroArchInput>(mapcol).Template; var fs = new PhysicalFileSystem(); var temp = Path.GetTempPath(); var pfs = fs.GetOrCreateSubFileSystem(fs.ConvertPathFromInternal(temp)); var dir = new FS.Directory("test", pfs, pfs.GetDirectoryEntry("/")); var context = new ConfigurationTraversalContext(); var list = context.TraverseInputTemplate(input, mapping, 0); var xmlSerializer = new SimpleXmlConfigurationSerializer("Config"); string outputXml = xmlSerializer.Transform(list); XDocument doc = XDocument.Parse(outputXml); Assert.NotEmpty(doc.Nodes()); }
public void InputTemplateToAbstractConfigurationNodeXmlSerializer_Test() { var testmappings = new StoneProvider().Controllers["XBOX_CONTROLLER"]; var realmapping = JsonConvert.DeserializeObject <ControllerLayout>( TestUtilities.GetStringResource("InputMappings.xinput_device.json")); var mapcol = ControllerElementMappings.GetDefaultMappings(realmapping, testmappings); string _mapping = TestUtilities.GetStringResource("InputMappings.DirectInput.XINPUT_DEVICE.json"); IInputMapping mapping = JsonConvert.DeserializeObject <InputMapping>(_mapping); var input = new InputTemplate <IRetroArchInput>(mapcol).Template; var fs = new PhysicalFileSystem(); var temp = Path.GetTempPath(); var pfs = fs.GetOrCreateSubFileSystem(fs.ConvertPathFromInternal(temp)); var dir = new FS.Directory("test", pfs, pfs.GetDirectoryEntry("/")); var context = new ConfigurationTraversalContext(); var list = context.TraverseInputTemplate(input, mapping, 0); var xmlSerializer = new SimpleXmlConfigurationSerializer("Config"); string outputXml = xmlSerializer.Transform(list); XDocument doc = XDocument.Parse(outputXml); Assert.NotEmpty(doc.Nodes()); }