private void TestTopicHandling(string topicKey, string expectedLanguage, string expectedTranslation, string lang1, string lang2, string lang3, string description)
{
_collectionSettings.Language1Iso639Code = lang1;
_collectionSettings.Language2Iso639Code = lang2;
_collectionSettings.Language3Iso639Code = lang3;
var bookDom = new HtmlDom(@"<html><body>
<div id='bloomDataDiv'>
<div data-book='topic' lang='en'>"+topicKey+@"</div>
</div>
<div id='somePage'>
<div id='test' data-derived='topic'>
</div>
</div>
</body></html>");
var data = new BookData(bookDom, _collectionSettings, null);
data.SynchronizeDataItemsThroughoutDOM();
try
{
if (string.IsNullOrEmpty(expectedLanguage))
{
AssertThatXmlIn.Dom(bookDom.RawDom)
.HasSpecifiedNumberOfMatchesForXpath(
"//div[@id='test' and @data-derived='topic' and not(@lang) and text()='" + expectedTranslation + "']", 1);
}
else
{
AssertThatXmlIn.Dom(bookDom.RawDom)
.HasSpecifiedNumberOfMatchesForXpath(
"//div[@id='test' and @data-derived='topic' and @lang='" + expectedLanguage + "' and text()='" +
expectedTranslation + "']", 1);
}
}
catch (Exception)
{
Assert.Fail(description);
}
}