public void BuildTranslationTableFromOrderedDatFileBinary_Test() { byte[] b = File.ReadAllBytes(TEST_DATA_PATH_IN); TranslationListBuilder builder = new TranslationListBuilder(new CultureInfo("en-GB")); List <Translation> translationList = builder.Build(b); Assert.IsNotNull(translationList); Assert.IsTrue(translationList.Any()); }
public void BuildOrderedDatFileFromTranslationList_Test() { byte[] b = File.ReadAllBytes(TEST_DATA_PATH_IN); TranslationListBuilder translationListBuilder = new TranslationListBuilder(new CultureInfo("en-GB")); List <Translation> translations = translationListBuilder.Build(b); SortedDatFileBinaryFileBuilder sortedDatFileBinaryFileBuilder = new SortedDatFileBinaryFileBuilder(); DatFile datFile = sortedDatFileBinaryFileBuilder.Build(new DatFileAttribute() { Translations = translations }); Assert.IsNotNull(datFile); }
internal static IEnumerable <Translation> LoadDatFile(string filePath, CultureInfo locale) { if (locale == null) { throw new ArgumentNullException($"The argument {nameof(locale)} must not be null."); } if (filePath == null) { throw new ArgumentNullException($"The argument {nameof(filePath)} must not be null."); } if (!File.Exists(filePath)) { throw new FileNotFoundException($"The file {filePath} does not exist."); } byte[] bytes = File.ReadAllBytes(filePath); TranslationListBuilder builder = new TranslationListBuilder(locale); return(builder.Build(bytes)); }