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(block1);
|
||||||
script.LootFilterBlocks.Add(block2);
|
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 +
|
"# This is a really great script!" + Environment.NewLine +
|
||||||
"# Multiple line script descriptions are fun!" + Environment.NewLine +
|
"# Multiple line script descriptions are fun!" + Environment.NewLine +
|
||||||
Environment.NewLine +
|
Environment.NewLine +
|
||||||
|
@ -141,6 +142,29 @@ namespace Filtration.Tests.Translators
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(expectedOutput, result);
|
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]
|
[Test]
|
||||||
public void TranslateStringToLootFilterScript_SectionDirectlyBeforeBlockWithoutDescription_ReturnsCorrectObject()
|
public void TranslateStringToLootFilterScript_SectionDirectlyBeforeBlockWithoutDescription_ReturnsCorrectObject()
|
||||||
|
|
|
@ -82,12 +82,18 @@ namespace Filtration.Translators
|
||||||
{
|
{
|
||||||
var outputString = string.Empty;
|
var outputString = string.Empty;
|
||||||
|
|
||||||
|
outputString += "# Script edited with Filtration - http://ben-wallis.github.io/Filtration/" +
|
||||||
|
Environment.NewLine;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(script.Description))
|
if (!string.IsNullOrEmpty(script.Description))
|
||||||
{
|
{
|
||||||
// ReSharper disable once LoopCanBeConvertedToQuery
|
// ReSharper disable once LoopCanBeConvertedToQuery
|
||||||
foreach (var line in new LineReader(() => new StringReader(script.Description)))
|
foreach (var line in new LineReader(() => new StringReader(script.Description)))
|
||||||
{
|
{
|
||||||
outputString += "# " + line + Environment.NewLine;
|
if (!line.Contains("Script edited with Filtration"))
|
||||||
|
{
|
||||||
|
outputString += "# " + line + Environment.NewLine;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
outputString += Environment.NewLine;
|
outputString += Environment.NewLine;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue