public void AssertFilesContain_NotesOnly_DifferentOrder() { // Setup CreateNotesTestData(@" <notes> <annotation class=""question"" ref=""silfw://localhost/link?app=flex&id=ff1c7330-4202-4bea-9243-54d3beefdead&label=B1""> <message status=""open"">comment about word B</message> </annotation> <annotation class=""question"" ref=""silfw://localhost/link?app=flex&database=current&server=&tool=default&guid=be1c7330-4201-41aa-9243-54d37f3e7fb0&tag=&id=be1c7330-4201-41aa-9243-54d37f3e7fb0&label=A3""> <message status=""open"">comment about word A</message> </annotation> </notes>" ); // SUT/Verify Assert.That(() => VerifyLanguageDepot.AssertFilesContain(XElement.Parse(@" <root> <notes> <annotation class=""question"" ref=""id=be1c7330-4201-41aa-9243-54d37f3e7fb0&label=A3""> <message status=""open"">comment about word A</message> </annotation> <annotation class=""question"" ref=""id=ff1c7330-4202-4bea-9243-54d3beefdead&label=B1""> <message status=""open"">comment about word B</message> </annotation> </notes> </root>" )), Throws.Exception.With.Message.StartsWith(" LanguageDepot: Attribute 'ref' of element 'annotation' doesn't contain expected value")); }
public void AssertFilesContain_NotesOnly_FileMissingElement() { // Setup CreateNotesTestData(@" <notes> <annotation class=""question"" ref=""silfw://localhost/link?app=flex&database=current&server=&tool=default&guid=be1c7330-4201-41aa-9243-54d37f3e7fb0&tag=&id=be1c7330-4201-41aa-9243-54d37f3e7fb0&label=A3""> <message status=""open"">comment about word A</message> </annotation> </notes>" ); // SUT/Verify Assert.That(() => VerifyLanguageDepot.AssertFilesContain(XElement.Parse(@" <root> <notes> <annotation class=""question"" ref=""id=be1c7330-4201-41aa-9243-54d37f3e7fb0&label=A3""> <message status=""open"">comment about word A</message> </annotation> <annotation class=""question"" ref=""id=ff1c7330-4202-4bea-9243-54d3beefdead&label=B1""> <message status=""open"">comment about word B</message> </annotation> </notes> </root>" )), Throws.Exception.With.Message.EqualTo(@" Expected: 2 But was: 1 ")); }
public void AssertFilesContain_LexiconAndNotes_AllElements() { // Setup CreateLexiconTestData(@" <Lexicon> <LexEntry> <LexemeForm> <MoStemAllomorph> <Form> <AUni ws=""fr2"">A3</AUni> </Form> </MoStemAllomorph> </LexemeForm> <Senses> <ownseq> <Gloss> <AUni ws=""en3"">Agloss4</AUni> </Gloss> </ownseq> </Senses> </LexEntry> </Lexicon>" ); CreateNotesTestData(@" <notes> <annotation class=""question"" ref=""silfw://localhost/link?app=flex&database=current&server=&tool=default&guid=be1c7330-4201-41aa-9243-54d37f3e7fb0&tag=&id=be1c7330-4201-41aa-9243-54d37f3e7fb0&label=A3""> <message status=""open"">comment about word A</message> </annotation> </notes>" ); // SUT/Verify Assert.That(() => VerifyLanguageDepot.AssertFilesContain(XElement.Parse(@" <root> <Lexicon> <LexEntry> <LexemeForm> <MoStemAllomorph> <Form> <AUni ws=""fr2"">A3</AUni> </Form> </MoStemAllomorph> </LexemeForm> <Senses> <ownseq> <Definition expectAbsence=""true"" /> <Gloss> <AUni ws=""en3"">Agloss4</AUni> </Gloss> </ownseq> </Senses> </LexEntry> </Lexicon> <notes> <annotation class=""question"" ref=""id=be1c7330-4201-41aa-9243-54d37f3e7fb0&label=A3""> <message status=""open"">comment about word A</message> </annotation> </notes> </root>" )), Throws.Nothing); }
public void AssertFilesContain_LexiconOnly_FileContainsElementThatShouldBeAbsent() { // Setup CreateLexiconTestData(@" <Lexicon> <LexEntry> <LexemeForm> <MoStemAllomorph> <Form> <AUni ws=""fr2"">A3</AUni> </Form> </MoStemAllomorph> </LexemeForm> <Senses> <ownseq> <Definition> <AUni ws=""en3"">A definition</AUni> </Definition> <Gloss> <AUni ws=""en3"">Agloss4</AUni> </Gloss> </ownseq> </Senses> </LexEntry> </Lexicon>" ); // SUT/Verify Assert.That(() => VerifyLanguageDepot.AssertFilesContain(XElement.Parse(@" <root> <Lexicon> <LexEntry> <LexemeForm> <MoStemAllomorph> <Form> <AUni ws=""fr2"">A3</AUni> </Form> </MoStemAllomorph> </LexemeForm> <Senses> <ownseq> <Definition expectAbsence=""true"" /> <Gloss> <AUni ws=""en3"">Agloss4</AUni> </Gloss> </ownseq> </Senses> </LexEntry> </Lexicon> </root>" )), Throws.Exception.With.Message.StartsWith(" LanguageDepot: Found element 'Definition' for parent 'ownseq' which should not be there")); }
public void AssertFilesContain_LexiconOnly_AllElements() { // Setup CreateLexiconTestData(@" <Lexicon> <LexEntry> <LexemeForm> <MoStemAllomorph> <Form> <AUni ws=""fr2"">A3</AUni> </Form> </MoStemAllomorph> </LexemeForm> <Senses> <ownseq> <Gloss> <AUni ws=""en3"">Agloss4</AUni> </Gloss> </ownseq> </Senses> </LexEntry> </Lexicon>" ); // SUT/Verify Assert.That(() => VerifyLanguageDepot.AssertFilesContain(XElement.Parse(@" <root> <Lexicon> <LexEntry> <LexemeForm> <MoStemAllomorph> <Form> <AUni ws=""fr2"">A3</AUni> </Form> </MoStemAllomorph> </LexemeForm> <Senses> <ownseq> <Definition expectAbsence=""true"" /> <Gloss> <AUni ws=""en3"">Agloss4</AUni> </Gloss> </ownseq> </Senses> </LexEntry> </Lexicon> </root>" )), Throws.Nothing); }
public void AssertFilesContain_LexiconOnly_FileHasDifferentValue() { // Setup CreateLexiconTestData(@" <Lexicon> <LexEntry> <LexemeForm> <MoStemAllomorph> <Form> <AUni ws=""fr2"">A5</AUni> </Form> </MoStemAllomorph> </LexemeForm> <Senses> <ownseq> <Gloss> <AUni ws=""en3"">Agloss4</AUni> </Gloss> </ownseq> </Senses> </LexEntry> </Lexicon>" ); // SUT/Verify Assert.That(() => VerifyLanguageDepot.AssertFilesContain(XElement.Parse(@" <root> <Lexicon> <LexEntry> <LexemeForm> <MoStemAllomorph> <Form> <AUni ws=""fr2"">A3</AUni> </Form> </MoStemAllomorph> </LexemeForm> <Senses> <ownseq> <Definition expectAbsence=""true"" /> <Gloss> <AUni ws=""en3"">Agloss4</AUni> </Gloss> </ownseq> </Senses> </LexEntry> </Lexicon> </root>" )), Throws.Exception.With.Message.StartsWith(" LanguageDepot: Missing LexEntry: '<Form> <AUni ws=\"fr2\">A3</AUni></Form>'")); }
public void FindXmlFile() { // Setup Settings.DataDirName = "comments-data"; Settings.DbName = "test-comment-sr"; var languageDepot = new LanguageDepotHelper(); languageDepot.ApplyPatches(Settings.MinModelVersion, 2); var sut = new VerifyLanguageDepotSpy(); // Exercise VerifyLanguageDepot.AssertFilesContain(XElement.Parse(@" <root> <Lexicon> <LexEntry> <LexemeForm> <MoStemAllomorph> <Form> <AUni ws=""fr"">A</AUni> </Form> </MoStemAllomorph> </LexemeForm> <Senses> <ownseq> <Definition expectAbsence=""true"" /> <Gloss> <AUni ws=""en"">A</AUni> </Gloss> </ownseq> </Senses> </LexEntry> </Lexicon> </root>" )); // Verify Assert.That(Path.GetFileName(sut.XmlFile), Is.EqualTo("Lexicon_07.lexdb")); }
public void AssertFilesContain_NotesWithReplies() { // Setup CreateNotesTestData(@" <notes> <annotation class=""question"" ref=""silfw://localhost/link?app=flex&id=ff1c7330-4202-4bea-9243-54d3beefdead&label=E""> <message status="""">FW comment on E</message> <message status=""open"">LF reply on E</message> <message status=""open"">FW reply on E</message> </annotation> </notes>" ); // SUT/Verify Assert.That(() => VerifyLanguageDepot.AssertFilesContain(XElement.Parse(@" <root> <notes> <annotation class=""question"" ref=""id=ff1c7330-4202-4bea-9243-54d3beefdead&label=E""> <message status="""">FW comment on E</message> <message status=""open"">LF reply on E</message> <message status=""open"">FW reply on E</message> </annotation> </notes> </root>" )), Throws.Nothing); }