| | 1 | | namespace NormalizationTests |
| | 2 | | { |
| | 3 | | public class ObjectPropertiesTests |
| | 4 | | { |
| | 5 | | public readonly string testFilesDirectory; |
| 0 | 6 | | public ObjectPropertiesTests() |
| 0 | 7 | | { |
| 0 | 8 | | testFilesDirectory = Path.Combine(GetProjectDirectory(), "TestFiles", "ObjectPropertiesTests"); |
| 0 | 9 | | } |
| | 10 | | static string GetProjectDirectory() |
| 0 | 11 | | { |
| 0 | 12 | | string? currentDirectory = Directory.GetCurrentDirectory(); |
| | 13 | |
|
| 0 | 14 | | while (!string.IsNullOrEmpty(currentDirectory)) |
| 0 | 15 | | { |
| 0 | 16 | | string[] projectFiles = Directory.GetFiles(currentDirectory, "*.csproj"); |
| | 17 | |
|
| 0 | 18 | | if (projectFiles.Length > 0) |
| 0 | 19 | | return currentDirectory; |
| 0 | 20 | | currentDirectory = Directory.GetParent(currentDirectory)?.FullName; |
| 0 | 21 | | } |
| | 22 | |
|
| 0 | 23 | | throw new Exception("Could not find project directory."); |
| 0 | 24 | | } |
| | 25 | | /* |
| | 26 | | [Fact] |
| | 27 | | public void ObjectPropertyReferencedObjectUsingStringTest() |
| | 28 | | { |
| | 29 | | string testFilePath = Path.Combine(testFilesDirectory, "testFile1.json"); |
| | 30 | | string jsonString = File.ReadAllText(testFilePath); |
| | 31 | | JObject jsonObject = JObject.Parse(jsonString); |
| | 32 | |
|
| | 33 | | List<Warning> warnings = new List<Warning>(); |
| | 34 | |
|
| | 35 | | Context context = Context.GetContextFromJToken(jsonObject, warnings); |
| | 36 | | context._base._value = "https://data.mff.cuni.cz/soubory/číselníky/"; |
| | 37 | |
|
| | 38 | | var property = jsonObject.Property("table"); |
| | 39 | | ObjectProperty<TableDescriptor>.Normalize(property?.Value!, context, property); |
| | 40 | |
|
| | 41 | | Assert.Equal(typeof(JObject), property.Value.GetType()); |
| | 42 | |
|
| | 43 | |
|
| | 44 | | } |
| | 45 | | */ |
| | 46 | | } |
| | 47 | | } |