public void ConvertToJson_InputValidXml_ReturnsTrue() { var xmlString = @"<?xml version='1.0' standalone='no'?> <root> <person id='1'> <name>Alan</name> <url>http://www.google.com</url> </person> <person id='2'> <name>Louis</name> <url>http://www.yahoo.com</url> </person> </root>"; var result = _xmlConverter.ConvertToJson(xmlString); Assert.IsNotEmpty(result, "Result shouldn't be empty."); }
private void ConvertFileSystemXmlFile(ConvertModel convert) { var data = _fileRepository.GetFileData(((FileSystemSourceModel)convert.Source).FullPath); string convertedString = string.Empty; switch (convert.Target.TargetFileType) { case TargetFileType.Json: convertedString = _xmlConverter.ConvertToJson(data); break; case TargetFileType.JsonCamelCase: convertedString = _xmlConverter.ConvertToJsonCamelCase(data); break; } _fileRepository.SaveFile(convertedString, convert.Target.FullPath); }