public async Task DoSimpleSyncT() { var syncCmd = new SyncCommand(); var packagesJson = new PackagesJson(); packagesJson.dependencies = new Dictionary <string, string>(); packagesJson.dependencies.Add("xunit.core", "2.4.1"); packagesJson.dependencies.Add("CommandLineParser", "2.3.0"); var packagesJsonPath = Path.Combine(_prjConfig.RootPath, _prjConfig.Nuget2BazelConfigName); await File.WriteAllTextAsync(packagesJsonPath, JsonConvert.SerializeObject(packagesJson)); await syncCmd.Do(_prjConfig); var readback = await File.ReadAllTextAsync(packagesJsonPath); var readbackJson = JsonConvert.DeserializeObject <PackagesJson>(readback); var filtered = readbackJson.dependencies.Select(y => y.Key).ToList(); Assert.Equal(18, filtered.Count); Assert.Contains("CommandLineParser", filtered); Assert.Contains("xunit.abstractions", filtered); Assert.Contains("xunit.core", filtered); Assert.Contains("xunit.extensibility.core", filtered); Assert.Contains("xunit.extensibility.execution", filtered); }
private static void parsePackagesJson() { string packagesPath = Path.Combine(Application.dataPath, "packages.json"); Debug.Log("Loading packages file: " + packagesPath); try { if (File.Exists(packagesPath)) { // TODO try/catch string dataAsJson = File.ReadAllText(packagesPath); packagesJson = JsonUtility.FromJson <PackagesJson>(dataAsJson); } else { EditorUtility.DisplayDialog("External Package Manager", "Unable to find " + packagesPath, "OK"); } } catch (Exception ex) { Debug.LogException(ex); } }