Ejemplo n.º 1
0
        public void AssertFilesContain_NotesOnly_DifferentOrder()
        {
            // Setup
            CreateNotesTestData(@"
			<notes>
				<annotation class=""question"" ref=""silfw://localhost/link?app=flex&amp;id=ff1c7330-4202-4bea-9243-54d3beefdead&amp;label=B1"">
					<message status=""open"">comment about word B</message>
				</annotation>
				<annotation class=""question"" ref=""silfw://localhost/link?app=flex&amp;database=current&amp;server=&amp;tool=default&amp;guid=be1c7330-4201-41aa-9243-54d37f3e7fb0&amp;tag=&amp;id=be1c7330-4201-41aa-9243-54d37f3e7fb0&amp;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&amp;label=A3"">
						<message status=""open"">comment about word A</message>
					</annotation>
					<annotation class=""question"" ref=""id=ff1c7330-4202-4bea-9243-54d3beefdead&amp;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"));
        }
Ejemplo n.º 2
0
        public void AssertFilesContain_NotesOnly_FileMissingElement()
        {
            // Setup
            CreateNotesTestData(@"
			<notes>
				<annotation class=""question"" ref=""silfw://localhost/link?app=flex&amp;database=current&amp;server=&amp;tool=default&amp;guid=be1c7330-4201-41aa-9243-54d37f3e7fb0&amp;tag=&amp;id=be1c7330-4201-41aa-9243-54d37f3e7fb0&amp;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&amp;label=A3"">
						<message status=""open"">comment about word A</message>
					</annotation>
					<annotation class=""question"" ref=""id=ff1c7330-4202-4bea-9243-54d3beefdead&amp;label=B1"">
						<message status=""open"">comment about word B</message>
					</annotation>
				</notes>
			</root>"            )), Throws.Exception.With.Message.EqualTo(@"  Expected: 2
  But was:  1
"));
        }
Ejemplo n.º 3
0
        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&amp;database=current&amp;server=&amp;tool=default&amp;guid=be1c7330-4201-41aa-9243-54d37f3e7fb0&amp;tag=&amp;id=be1c7330-4201-41aa-9243-54d37f3e7fb0&amp;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&amp;label=A3"">
						<message status=""open"">comment about word A</message>
					</annotation>
				</notes>
			</root>"            )), Throws.Nothing);
        }
Ejemplo n.º 4
0
        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"));
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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>'"));
        }
Ejemplo n.º 7
0
        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"));
        }
Ejemplo n.º 8
0
        public void AssertFilesContain_NotesWithReplies()
        {
            // Setup
            CreateNotesTestData(@"
			<notes>
				<annotation class=""question"" ref=""silfw://localhost/link?app=flex&amp;id=ff1c7330-4202-4bea-9243-54d3beefdead&amp;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&amp;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);
        }
Ejemplo n.º 9
0
 protected static void ReplaceInstance(VerifyLanguageDepot newInstance)
 {
     _instance = newInstance;
 }
Ejemplo n.º 10
0
 static VerifyLanguageDepot()
 {
     _instance = new VerifyLanguageDepot();
 }
Ejemplo n.º 11
0
 public void FixtureSetUp()
 {
     _VerifyLanguageDepot = new VerifyLanguageDepotDouble();
 }