FIL-13 Comments on the Show/Hide line are now preserved if block groups are not enabled for the script
This commit is contained in:
@@ -26,6 +26,41 @@ namespace Filtration.Parser.Tests.Services
|
||||
_testUtility = new ItemFilterBlockTranslatorTestUtility();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_BlockGroupsEnabled_ActionBlockItemCommentIsNull()
|
||||
{
|
||||
|
||||
// Arrange
|
||||
var inputString = "Show # Test - Test2 - Test3" + Environment.NewLine;
|
||||
|
||||
var inputBlockGroup = new ItemFilterBlockGroup("TestBlockGroup", null);
|
||||
_testUtility.MockBlockGroupHierarchyBuilder
|
||||
.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>()))
|
||||
.Returns(inputBlockGroup);
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScriptSettings>(i => i.BlockGroupsEnabled));
|
||||
|
||||
//Assert
|
||||
Assert.IsTrue(string.IsNullOrEmpty(result.ActionBlockItem.Comment));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_BlockGroupsDisabled_ActionBlockItemCommentIsSetCorrectly()
|
||||
{
|
||||
|
||||
// Arrange
|
||||
var testInputExpectedComment = " this is a comment that should be preserved";
|
||||
|
||||
var inputString = $"Show #{testInputExpectedComment}" + Environment.NewLine;
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScriptSettings>(i => i.BlockGroupsEnabled == false));
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual(testInputExpectedComment, result.ActionBlockItem.Comment);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_NotDisabled_SetsBlockEnabledTrue()
|
||||
{
|
||||
@@ -1044,6 +1079,22 @@ namespace Filtration.Parser.Tests.Services
|
||||
Assert.AreEqual(expectedResult, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateItemFilterBlockToString_HasActionBlockComment_ReturnsCorrectString()
|
||||
{
|
||||
// Arrange
|
||||
var testInputActionBlockComment = "this is a test";
|
||||
var expectedResult = $"Show #{testInputActionBlockComment}";
|
||||
|
||||
_testUtility.TestBlock.BlockItems.OfType<ActionBlockItem>().First().Comment = testInputActionBlockComment;
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(expectedResult, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateItemFilterBlockToString_FilterTypeHide_ReturnsCorrectString()
|
||||
{
|
||||
|
||||
@@ -348,6 +348,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
Assert.AreEqual("This is a disabled block", secondBlock.Description);
|
||||
}
|
||||
|
||||
// TODO: Reinstate this test
|
||||
[Ignore("Ignored until toggling block group parsing can be controlled from the filter script input")]
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterScript_DisabledBlockWithBlockGroup_ReturnsCorrectBlock()
|
||||
|
||||
Reference in New Issue
Block a user