Add new filter fuatures

This commit is contained in:
azakhi
2018-08-29 20:12:02 +03:00
parent a09f0a5090
commit 78b4ddc862
78 changed files with 911 additions and 231 deletions

View File

@@ -890,42 +890,6 @@ namespace Filtration.Parser.Tests.Services
Assert.AreEqual(1, result.BlockItems.Count(b => b is DisableDropSoundBlockItem));
var blockItem = result.BlockItems.OfType<DisableDropSoundBlockItem>().First();
Assert.IsTrue(blockItem.BooleanValue);
}
[Test]
public void TranslateStringToItemFilterBlock_DropIcon_ReturnsCorrectObject()
{
// Arrange
var inputString = "Show" + Environment.NewLine +
" Icon Icon1";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is IconBlockItem));
var blockItem = result.BlockItems.OfType<IconBlockItem>().First();
Assert.AreEqual("Icon1", blockItem.Value);
}
[Test]
public void TranslateStringToItemFilterBlock_BeamColor_ReturnsCorrectObject()
{
// Arrange
var inputString = "Show" + Environment.NewLine +
" BeamColor 255 20 100 True";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is BeamBlockItem));
var blockItem = result.BlockItems.OfType<BeamBlockItem>().First();
Assert.AreEqual(255, blockItem.Color.R);
Assert.AreEqual(20, blockItem.Color.G);
Assert.AreEqual(100, blockItem.Color.B);
Assert.IsTrue(blockItem.BooleanValue);
}
[Test]
@@ -961,9 +925,7 @@ namespace Filtration.Parser.Tests.Services
" SetBorderColor 0 0 0" + Environment.NewLine +
" SetFontSize 50" + Environment.NewLine +
" PlayAlertSound 3" + Environment.NewLine +
" DisableDropSound False" + Environment.NewLine +
" Icon Icon2" + Environment.NewLine +
" BeamColor 255 100 5 false" + Environment.NewLine;
" DisableDropSound False" + Environment.NewLine;
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
@@ -1068,15 +1030,6 @@ namespace Filtration.Parser.Tests.Services
var disableDropSoundBlockItem = result.BlockItems.OfType<DisableDropSoundBlockItem>().First();
Assert.IsFalse(disableDropSoundBlockItem.BooleanValue);
var iconBlockItem = result.BlockItems.OfType<IconBlockItem>().First();
Assert.AreEqual("Icon2", iconBlockItem.Value);
var beamBlockItem = result.BlockItems.OfType<BeamBlockItem>().First();
Assert.AreEqual(255, beamBlockItem.Color.R);
Assert.AreEqual(100, beamBlockItem.Color.G);
Assert.AreEqual(5, beamBlockItem.Color.B);
Assert.IsFalse(beamBlockItem.BooleanValue);
}
[Test]
@@ -1903,23 +1856,6 @@ namespace Filtration.Parser.Tests.Services
Assert.AreEqual(expectedResult, result);
}
[Ignore("Ignore until the new block type is fully implemented")]
[Test]
public void TranslateItemFilterBlockToString_DropIcon_ReturnsCorrectString()
{
// Arrange
var expectedResult = "Show" + Environment.NewLine +
" Icon Icon3";
_testUtility.TestBlock.BlockItems.Add(new IconBlockItem("Icon3"));
// Act
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
// Assert
Assert.AreEqual(expectedResult, result);
}
[Test]
public void TranslateItemFilterBlockToString_Everything_ReturnsCorrectString()
{
@@ -1951,9 +1887,7 @@ namespace Filtration.Parser.Tests.Services
" SetBorderColor 255 1 254" + Environment.NewLine +
" SetFontSize 50" + Environment.NewLine +
" PlayAlertSound 6 90" + Environment.NewLine +
" DisableDropSound True";/* + Environment.NewLine +
" Icon Icon4";
" BeamColor 120 130 140 False";*/
" DisableDropSound True";
_testUtility.TestBlock.BlockItems.Add(new ActionBlockItem(BlockAction.Show));
_testUtility.TestBlock.BlockItems.Add(new IdentifiedBlockItem(true));
@@ -1997,8 +1931,6 @@ namespace Filtration.Parser.Tests.Services
_testUtility.TestBlock.BlockItems.Add(new ShapedMapBlockItem(true));
_testUtility.TestBlock.BlockItems.Add(new ElderMapBlockItem(true));
_testUtility.TestBlock.BlockItems.Add(new DisableDropSoundBlockItem(true));
_testUtility.TestBlock.BlockItems.Add(new IconBlockItem("Icon4"));
_testUtility.TestBlock.BlockItems.Add(new BeamBlockItem(new Color { A = 255, R = 120, G = 130, B = 140 }, false));
// Act
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);