Add a temporary block type for new beam feature

This commit is contained in:
azakhi
2018-08-22 13:15:50 +03:00
parent add7514ce7
commit 2a7df9a1ca
7 changed files with 82 additions and 7 deletions

View File

@@ -907,6 +907,24 @@ namespace Filtration.Parser.Tests.Services
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";
// 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);
}
[Test]
@@ -943,7 +961,8 @@ namespace Filtration.Parser.Tests.Services
" SetFontSize 50" + Environment.NewLine +
" PlayAlertSound 3" + Environment.NewLine +
" DisableDropSound False" + Environment.NewLine +
" Icon Icon2" + Environment.NewLine;
" Icon Icon2" + Environment.NewLine +
" BeamColor 255 100 5" + Environment.NewLine;
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
@@ -1051,6 +1070,11 @@ namespace Filtration.Parser.Tests.Services
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);
}
[Test]
@@ -1877,6 +1901,7 @@ 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()
{
@@ -1924,8 +1949,9 @@ 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";
" DisableDropSound True";/* + Environment.NewLine +
" Icon Icon4";
" BeamColor 120 130 140";*/
_testUtility.TestBlock.BlockItems.Add(new ActionBlockItem(BlockAction.Show));
_testUtility.TestBlock.BlockItems.Add(new IdentifiedBlockItem(true));
@@ -1970,6 +1996,7 @@ namespace Filtration.Parser.Tests.Services
_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 }));
// Act
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);