Added Edited wi
This commit is contained in:
parent
301b24d324
commit
722c720a06
|
@ -119,7 +119,8 @@ namespace Filtration.Tests.Translators
|
|||
script.LootFilterBlocks.Add(block1);
|
||||
script.LootFilterBlocks.Add(block2);
|
||||
|
||||
var expectedOutput = "# Test script description" + Environment.NewLine +
|
||||
var expectedOutput = "# Script edited with Filtration - http://ben-wallis.github.io/Filtration/" + Environment.NewLine +
|
||||
"# Test script description" + Environment.NewLine +
|
||||
"# This is a really great script!" + Environment.NewLine +
|
||||
"# Multiple line script descriptions are fun!" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
|
@ -142,6 +143,29 @@ namespace Filtration.Tests.Translators
|
|||
Assert.AreEqual(expectedOutput, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateLootFilterScriptToString_FullScriptWithExistingFiltrationTagline_ReturnsCorrectOutput()
|
||||
{
|
||||
var script = new LootFilterScript
|
||||
{
|
||||
Description = "Script edited with Filtration - http://ben-wallis.github.io/Filtration/" + Environment.NewLine +
|
||||
"Test script description" + Environment.NewLine
|
||||
};
|
||||
|
||||
var expectedOutput = "# Script edited with Filtration - http://ben-wallis.github.io/Filtration/" +
|
||||
Environment.NewLine +
|
||||
"# Test script description" + Environment.NewLine + Environment.NewLine;
|
||||
|
||||
var blockTranslator = new LootFilterBlockTranslator();
|
||||
var translator = new LootFilterScriptTranslator(blockTranslator);
|
||||
|
||||
// Act
|
||||
var result = translator.TranslateLootFilterScriptToString(script);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(expectedOutput, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToLootFilterScript_SectionDirectlyBeforeBlockWithoutDescription_ReturnsCorrectObject()
|
||||
{
|
||||
|
|
|
@ -82,13 +82,19 @@ namespace Filtration.Translators
|
|||
{
|
||||
var outputString = string.Empty;
|
||||
|
||||
outputString += "# Script edited with Filtration - http://ben-wallis.github.io/Filtration/" +
|
||||
Environment.NewLine;
|
||||
|
||||
if (!string.IsNullOrEmpty(script.Description))
|
||||
{
|
||||
// ReSharper disable once LoopCanBeConvertedToQuery
|
||||
foreach (var line in new LineReader(() => new StringReader(script.Description)))
|
||||
{
|
||||
if (!line.Contains("Script edited with Filtration"))
|
||||
{
|
||||
outputString += "# " + line + Environment.NewLine;
|
||||
}
|
||||
}
|
||||
outputString += Environment.NewLine;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue