public void InputTemplateToAbstractConfigurationNodeJsonSerializer_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 jsonSerializer = new SimpleJsonConfigurationSerializer(); string outputJson = jsonSerializer.Visit(list); var jtoken = JToken.Parse(outputJson); Assert.True(jtoken.HasValues); }
public void CollectionToAbstractConfigurationNodeJsonSerializer_Test() { var configuration = new ConfigurationCollection <ExampleConfigurationCollection>(new ConfigurationValueCollection()); var fs = new PhysicalFileSystem(); var temp = Path.GetTempPath(); var pfs = fs.GetOrCreateSubFileSystem(fs.ConvertPathFromInternal(temp)); string test = Path.GetRandomFileName(); var dir = new FS.Directory(test, pfs, pfs.GetDirectoryEntry("/")); dir.OpenDirectory("program") .OpenFile("RMGE01.wbfs").OpenStream().Close(); configuration.Configuration.ExampleConfiguration.FullscreenResolution = FullscreenResolution.Resolution1152X648; var context = new ConfigurationTraversalContext(("game", dir)); var list = context.TraverseCollection(configuration); IAbstractConfigurationNode dolphinList = list["#dolphin"]; var jsonSerializer = new SimpleJsonConfigurationSerializer(); string outputJson = jsonSerializer.Visit(dolphinList); var jtoken = JToken.Parse(outputJson); Assert.True(jtoken.HasValues); }