public override Translation With( string?originalText = null, string?translatedText = null, IEnumerable <GlossNote>?glosses = null, IEnumerable <TranslatorNote>?notes = null, IEnumerable <TranslatedText>?alternativeTranslations = null) { var clone = GetJson(); clone.Source = originalText ?? clone.Source; clone.Target = translatedText ?? clone.Target; if (notes != null) { clone.Notes = clone.Notes .Select(n => n.Uuid) .Concat(EnumerableExt.Repeat("infinity").Select(_ => System.Guid.NewGuid())) .Zip( notes, (id, note) => new NoteJson() { Uuid = id, Content = note.Text }) .ToList(); } return(new TextEntryTranslation(clone)); }
public void BasicCompatibility(string sentence, IEnumerable <IEntry> expectedEntries) { var ipadicEntries = ipadicMecab.ParseToEntries(sentence).Where(e => e.IsRegular); // this is to make test cases fail in case the number of expecteds is less than the number of actuals var nullDummyEntry = new DummyEntry(); foreach (var(i, e) in EnumerableExt.Zip(ipadicEntries, expectedEntries.Concat(EnumerableExt.Repeat(nullDummyEntry)))) { //Assert.AreEqual(e.ConjugatedForm, i.ConjugatedForm); //Assert.AreEqual(e.Inflection, i.Inflection); Assert.AreEqual(e.SurfaceForm, i.SurfaceForm); //Assert.AreEqual(e.PartOfSpeechString, i.PartOfSpeechString); Assert.AreEqual(e.Pronunciation, i.Pronunciation); Assert.AreEqual(e.Reading, i.Reading); Assert.AreEqual(e.DictionaryForm, i.DictionaryForm); } }