public string TranslateItemFilterScriptToString(ItemFilterScript script) { var outputString = string.Empty; outputString += "# Script edited with Filtration - https://github.com/ben-wallis/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; } // ReSharper disable once LoopCanBeConvertedToQuery foreach (var block in script.ItemFilterBlocks) { outputString += _blockTranslator.TranslateItemFilterBlockToString(block) + Environment.NewLine; if (Settings.Default.ExtraLineBetweenBlocks) { outputString += Environment.NewLine; } } return(outputString); }
public void SaveItemFilterScript_CallsTranslatorAndFileSystemService() { // Arrange var testFilePath = "C:\\Test\\File.txt"; var testScript = new ItemFilterScript { FilePath = testFilePath }; var testTranslatedScript = "Test translated script"; var mockFileSystemService = new Mock <IFileSystemService>(); mockFileSystemService.Setup(s => s.WriteFileFromString(testFilePath, testTranslatedScript)).Verifiable(); var mockItemFilterScriptTranslator = new Mock <IItemFilterScriptTranslator>(); mockItemFilterScriptTranslator.Setup(t => t.TranslateItemFilterScriptToString(testScript)).Returns(testTranslatedScript).Verifiable(); var service = new ItemFilterPersistenceService(mockFileSystemService.Object, mockItemFilterScriptTranslator.Object); // Act service.SaveItemFilterScript(testScript); // Assert mockFileSystemService.Verify(); mockItemFilterScriptTranslator.Verify(); }
public void Initialise(ItemFilterScript itemFilterScript, bool newScript) { ItemFilterBlockViewModels.Clear(); Script = itemFilterScript; foreach (var block in Script.ItemFilterBlocks) { var vm = _itemFilterBlockViewModelFactory.Create(); vm.Initialise(block, this); ItemFilterBlockViewModels.Add(vm); } _filenameIsFake = newScript; if (newScript) { Script.FilePath = "Untitled.filter"; } if (ItemFilterBlockViewModels.Count > 0) { SelectedBlockViewModel = ItemFilterBlockViewModels.First(); } Title = Filename; ContentId = "ScriptContentId"; }
public void TranslateItemFilterScriptToString_OneBlock_CallsTranslator() { // Arrange var testScript = new ItemFilterScript(); var testBlock = new ItemFilterBlock(); testBlock.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.Equal, 5)); const string blockOutput = "Test Script Output"; testScript.ItemFilterBlocks.Add(testBlock); var mockItemFilterBlockTranslator = new Mock <IItemFilterBlockTranslator>(); mockItemFilterBlockTranslator .Setup(t => t.TranslateItemFilterBlockBaseToString(testBlock)) .Returns(blockOutput) .Verifiable(); var translator = CreateItemFilterScriptTranslator(itemFilterBlockTranslator: mockItemFilterBlockTranslator.Object); // Act translator.TranslateItemFilterScriptToString(testScript); // Assert mockItemFilterBlockTranslator.Verify(); }
public void ReplaceColors_ReplacesBackgroundColorsCorrectly() { // Arrange var oldColor = new Color {A = 255, R = 255, G = 0, B = 0}; var newColor = new Color {A = 255, R = 0, G = 255, B = 100}; var testInputReplaceColors = new ReplaceColorsParameterSet { OldBackgroundColor = oldColor, NewBackgroundColor = newColor, ReplaceBackgroundColor = true }; var testInputBlock1 = new ItemFilterBlock(); testInputBlock1.BlockItems.Add(new BackgroundColorBlockItem(new Color {A = 255, R = 255, G = 0, B = 0})); var testInputBlock2 = new ItemFilterBlock(); testInputBlock2.BlockItems.Add(new BackgroundColorBlockItem(new Color { A = 255, R = 255, G = 1, B = 0 })); var testInputBlock3 = new ItemFilterBlock(); testInputBlock3.BlockItems.Add(new BackgroundColorBlockItem(new Color { A = 255, R = 255, G = 0, B = 0 })); var script = new ItemFilterScript(); script.ItemFilterBlocks.Add(testInputBlock1); script.ItemFilterBlocks.Add(testInputBlock2); script.ItemFilterBlocks.Add(testInputBlock3); // Act script.ReplaceColors(testInputReplaceColors); // Assert Assert.AreEqual(newColor, testInputBlock1.BlockItems.OfType<BackgroundColorBlockItem>().First().Color); Assert.AreNotEqual(newColor, testInputBlock2.BlockItems.OfType<BackgroundColorBlockItem>().First().Color); Assert.AreEqual(newColor, testInputBlock3.BlockItems.OfType<BackgroundColorBlockItem>().First().Color); }
public void LoadItemFilterScript_CallsTranslatorAndFileSystemService() { // Arrange const string TestInputPath = "C:\\Test Path\\Script.Filter"; const string TestScriptString = "This is a test item filter script"; var testItemFilterScript = new ItemFilterScript(); var mockFileSystemService = new Mock <IFileSystemService>(); mockFileSystemService.Setup(s => s.ReadFileAsString(TestInputPath)).Returns(TestScriptString).Verifiable(); var mockItemFilterScriptTranslator = new Mock <IItemFilterScriptTranslator>(); mockItemFilterScriptTranslator.Setup(t => t.TranslateStringToItemFilterScript(TestScriptString)).Returns(testItemFilterScript).Verifiable(); var service = new ItemFilterPersistenceService(mockFileSystemService.Object, mockItemFilterScriptTranslator.Object); // Act var script = service.LoadItemFilterScript(TestInputPath); // Assert mockFileSystemService.Verify(); mockItemFilterScriptTranslator.Verify(); Assert.AreEqual(testItemFilterScript, script); }
public void Initialise(ItemFilterScript itemFilterScript, ItemFilterBlock initialiseFromBlock) { _replaceColorsParameterSet = new ReplaceColorsParameterSet(); if (initialiseFromBlock.BlockItems.Count(b => b.GetType() == typeof(TextColorBlockItem)) > 0) { _replaceColorsParameterSet.ReplaceTextColor = true; var existingBlockColor = ((TextColorBlockItem) initialiseFromBlock.BlockItems.First(b => b.GetType() == typeof(TextColorBlockItem))).Color; _replaceColorsParameterSet.OldTextColor = existingBlockColor; _replaceColorsParameterSet.NewTextColor = existingBlockColor; } if (initialiseFromBlock.BlockItems.Count(b => b.GetType() == typeof(BackgroundColorBlockItem)) > 0) { _replaceColorsParameterSet.ReplaceBackgroundColor = true; var existingBlockColor = ((BackgroundColorBlockItem) initialiseFromBlock.BlockItems.First(b => b.GetType() == typeof(BackgroundColorBlockItem))).Color; _replaceColorsParameterSet.OldBackgroundColor = existingBlockColor; _replaceColorsParameterSet.NewBackgroundColor = existingBlockColor; } if (initialiseFromBlock.BlockItems.Count(b => b.GetType() == typeof(BorderColorBlockItem)) > 0) { _replaceColorsParameterSet.ReplaceBorderColor = true; var existingBlockColor = ((BorderColorBlockItem) initialiseFromBlock.BlockItems.First(b => b.GetType() == typeof(BorderColorBlockItem))).Color; _replaceColorsParameterSet.OldBorderColor = existingBlockColor; _replaceColorsParameterSet.NewBorderColor = existingBlockColor; } _itemFilterScript = itemFilterScript; }
public void ApplyThemeToScript_SingleBlockDifferentComponentName_DoesNotReplaceColour() { // Arrange var testInputBlockItem = new TextColorBlockItem(); var testInputBlock = new ItemFilterBlock(); testInputBlock.BlockItems.Add(testInputBlockItem); var testInputScript = new ItemFilterScript(); testInputScript.ItemFilterBlocks.Add(testInputBlock); var testInputTheme = new Theme(); var testInputThemeComponentColor = new Color { R = 255, G = 0, B = 1 }; var testInputThemeComponent = new ThemeComponent(ThemeComponentType.TextColor, "Test Component 1", testInputThemeComponentColor); var testInputBlockItemThemeComponent = new ThemeComponent(ThemeComponentType.TextColor, "Different Component", testInputThemeComponentColor); testInputTheme.Components.Add(testInputThemeComponent); testInputBlockItem.ThemeComponent = testInputBlockItemThemeComponent; var mockMessageBoxService = new Mock <IMessageBoxService>(); var service = new ThemeService(mockMessageBoxService.Object); // Act service.ApplyThemeToScript(testInputTheme, testInputScript); // Assert Assert.AreNotEqual(testInputThemeComponentColor, testInputBlockItem.Color); }
public async Task SaveItemFilterScriptAsync(ItemFilterScript script) { await Task.Run(() => { _fileSystemService.WriteFileFromString(script.FilePath, _itemFilterScriptTranslator.TranslateItemFilterScriptToString(script)); }); }
public IThemeEditorViewModel MasterThemeForScript(ItemFilterScript script) { var themeViewModel = _themeViewModelFactory.Create(); themeViewModel.InitialiseForMasterTheme(script); themeViewModel.FilePath = "<Master Theme> " + Path.GetFileName(script.FilePath); return(themeViewModel); }
public IItemFilterScriptViewModel NewScript() { var newScript = new ItemFilterScript(); var newViewModel = _itemFilterScriptViewModelFactory.Create(); newViewModel.Initialise(newScript, true); return(newViewModel); }
public void ReplaceColors_OnlyReplacesColorsWhenAllSetParametersMatched() { // Arrange var oldBackgroundColor = new Color { A = 255, R = 255, G = 0, B = 0 }; var newBackgroundColor = new Color { A = 255, R = 0, G = 255, B = 100 }; var oldTextColor = new Color { A = 255, R = 100, G = 0, B = 50 }; var newTextColor = new Color { A = 255, R = 101, G = 255, B = 51 }; var testInputReplaceColors = new ReplaceColorsParameterSet { OldBackgroundColor = oldBackgroundColor, NewBackgroundColor = newBackgroundColor, OldTextColor = oldTextColor, NewTextColor = newTextColor, ReplaceBackgroundColor = true, ReplaceTextColor = true }; var testInputBlock1 = new ItemFilterBlock(); testInputBlock1.BlockItems.Add(new BackgroundColorBlockItem(oldBackgroundColor)); testInputBlock1.BlockItems.Add(new TextColorBlockItem(oldTextColor)); var testInputBlock2 = new ItemFilterBlock(); testInputBlock2.BlockItems.Add(new BackgroundColorBlockItem(oldBackgroundColor)); testInputBlock2.BlockItems.Add(new TextColorBlockItem(new Color { A = 1, R = 2, G = 3, B = 4 })); var script = new ItemFilterScript(); script.ItemFilterBlocks.Add(testInputBlock1); script.ItemFilterBlocks.Add(testInputBlock2); // Act script.ReplaceColors(testInputReplaceColors); // Assert // First test block has had its colors changed Assert.AreEqual(newBackgroundColor, testInputBlock1.BlockItems.OfType <BackgroundColorBlockItem>().First().Color); Assert.AreEqual(newTextColor, testInputBlock1.BlockItems.OfType <TextColorBlockItem>().First().Color); // Second test block has not had its colors changed Assert.AreEqual(oldBackgroundColor, testInputBlock2.BlockItems.OfType <BackgroundColorBlockItem>().First().Color); Assert.AreNotEqual(newTextColor, testInputBlock2.BlockItems.OfType <TextColorBlockItem>().First().Color); }
public void Validate_AtLeastOneBlock_Fail_ReturnsListWithCorrectError() { // Arrange var script = new ItemFilterScript(); // Act var result = script.Validate(); // Assert Assert.AreEqual(1, result.Count(r => r.Contains("A script must have at least one block"))); }
public void ApplyThemeToScript(Theme theme, ItemFilterScript script) { var mismatchedComponents = false; foreach (var component in theme.Components) { var componentMatched = false; Type targetType = null; switch (component.ComponentType) { case ThemeComponentType.BackgroundColor: targetType = typeof(BackgroundColorBlockItem); break; case ThemeComponentType.TextColor: targetType = typeof(TextColorBlockItem); break; case ThemeComponentType.BorderColor: targetType = typeof(BorderColorBlockItem); break; } foreach (var block in script.ItemFilterBlocks) { foreach (var blockItem in block.BlockItems.Where(i => i.GetType() == targetType)) { var colorBlockItem = (ColorBlockItem)blockItem; if (colorBlockItem.ThemeComponent != null && colorBlockItem.ThemeComponent.ComponentName == component.ComponentName) { colorBlockItem.Color = component.Color; componentMatched = true; } } } if (!componentMatched) { mismatchedComponents = true; } } if (mismatchedComponents) { _messageBoxService.Show("Possible Theme Mismatch", "Not all theme components had matches - are you sure this theme is designed for this script?", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
public void Validate_AtLeastOneBlock_Pass_ReturnsListWithoutError() { // Arrange var script = new ItemFilterScript(); script.ItemFilterBlocks.Add(new ItemFilterBlock()); // Act var result = script.Validate(); // Assert Assert.AreEqual(0, result.Count(r => r.Contains("A script must have at least one block"))); }
public void ReplaceColors_ReplacesBackgroundColorsCorrectly() { // Arrange var oldColor = new Color { A = 255, R = 255, G = 0, B = 0 }; var newColor = new Color { A = 255, R = 0, G = 255, B = 100 }; var testInputReplaceColors = new ReplaceColorsParameterSet { OldBackgroundColor = oldColor, NewBackgroundColor = newColor, ReplaceBackgroundColor = true }; var testInputBlock1 = new ItemFilterBlock(); testInputBlock1.BlockItems.Add(new BackgroundColorBlockItem(new Color { A = 255, R = 255, G = 0, B = 0 })); var testInputBlock2 = new ItemFilterBlock(); testInputBlock2.BlockItems.Add(new BackgroundColorBlockItem(new Color { A = 255, R = 255, G = 1, B = 0 })); var testInputBlock3 = new ItemFilterBlock(); testInputBlock3.BlockItems.Add(new BackgroundColorBlockItem(new Color { A = 255, R = 255, G = 0, B = 0 })); var script = new ItemFilterScript(); script.ItemFilterBlocks.Add(testInputBlock1); script.ItemFilterBlocks.Add(testInputBlock2); script.ItemFilterBlocks.Add(testInputBlock3); // Act script.ReplaceColors(testInputReplaceColors); // Assert Assert.AreEqual(newColor, testInputBlock1.BlockItems.OfType <BackgroundColorBlockItem>().First().Color); Assert.AreNotEqual(newColor, testInputBlock2.BlockItems.OfType <BackgroundColorBlockItem>().First().Color); Assert.AreEqual(newColor, testInputBlock3.BlockItems.OfType <BackgroundColorBlockItem>().First().Color); }
public async Task <ItemFilterScript> LoadItemFilterScriptAsync(string filePath) { ItemFilterScript loadedScript = null; await Task.Run(() => { loadedScript = _itemFilterScriptTranslator.TranslateStringToItemFilterScript( _fileSystemService.ReadFileAsString(filePath)); }); if (loadedScript != null) { loadedScript.FilePath = filePath; } return(loadedScript); }
public IThemeEditorViewModel NewThemeForScript(ItemFilterScript script) { var themeComponentCollection = script.ThemeComponents.Aggregate(new ThemeComponentCollection(), (c, component) => { c.Add(new ThemeComponent(component.ComponentType, component.ComponentName, component.Color)); return(c); }); var themeViewModel = _themeViewModelFactory.Create(); themeViewModel.InitialiseForNewTheme(themeComponentCollection); themeViewModel.FilePath = "Untitled.filtertheme"; return(themeViewModel); }
public void TranslateItemFilterScriptToString_FullScript_ReturnsCorrectOutput() { var script = new ItemFilterScript { Description = "Test script description" + Environment.NewLine + "This is a really great script!" + Environment.NewLine + "Multiple line script descriptions are fun!" }; var block1 = new ItemFilterBlock { Description = "Test Filter 1" }; block1.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 5)); var block2 = new ItemFilterBlock(); block2.BlockItems.Add(new QualityBlockItem(FilterPredicateOperator.LessThan, 15)); block2.BlockItems.Add(new FontSizeBlockItem(7)); block2.BlockItems.Add(new WidthBlockItem(FilterPredicateOperator.Equal, 3)); script.ItemFilterBlocks.Add(block1); script.ItemFilterBlocks.Add(block2); var expectedOutput = "# Script edited with Filtration - https://github.com/ben-wallis/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 + "# Test Filter 1" + Environment.NewLine + "Show" + Environment.NewLine + " ItemLevel > 5" + Environment.NewLine + Environment.NewLine + "Show" + Environment.NewLine + " Quality < 15" + Environment.NewLine + " Width = 3" + Environment.NewLine + " SetFontSize 7" + Environment.NewLine + Environment.NewLine; var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object); var translator = new ItemFilterScriptTranslator(blockTranslator, _testUtility.MockBlockGroupHierarchyBuilder.Object); // Act var result = translator.TranslateItemFilterScriptToString(script); // Assert Assert.AreEqual(expectedOutput, result); }
public ItemFilterScript TranslateStringToItemFilterScript(string inputString) { var script = new ItemFilterScript(); _blockGroupHierarchyBuilder.Initialise(script.ItemFilterBlockGroups.First()); inputString = inputString.Replace("\t", ""); if (inputString.Contains("#Disabled Block Start")) { inputString = PreprocessDisabledBlocks(inputString); } var conditionBoundaries = IdentifyBlockBoundaries(inputString); var lines = Regex.Split(inputString, "\r\n|\r|\n"); // Process the script header for (var i = 0; i < conditionBoundaries.First.Value; i++) { if (lines[i].StartsWith("#")) { script.Description += lines[i].Substring(1).Trim(' ') + Environment.NewLine; } } if (!string.IsNullOrEmpty(script.Description)) { script.Description = script.Description.TrimEnd('\n').TrimEnd('\r'); } // Extract each block from between boundaries and translate it into a ItemFilterBlock object // and add that object to the ItemFilterBlocks list for (var boundary = conditionBoundaries.First; boundary != null; boundary = boundary.Next) { var begin = boundary.Value; var end = boundary.Next?.Value ?? lines.Length; var block = new string[end - begin]; Array.Copy(lines, begin, block, 0, end - begin); var blockString = string.Join("\r\n", block); script.ItemFilterBlocks.Add(_blockTranslator.TranslateStringToItemFilterBlock(blockString, script.ThemeComponents)); } _blockGroupHierarchyBuilder.Cleanup(); return(script); }
public void TranslateItemFilterScriptToString_FullScriptWithExistingFiltrationTagline_ReturnsCorrectOutput() { var script = new ItemFilterScript { Description = "Script edited with Filtration - https://github.com/ben-wallis/Filtration" + Environment.NewLine + "Test script description" + Environment.NewLine }; var expectedOutput = "# Script edited with Filtration - https://github.com/ben-wallis/Filtration" + Environment.NewLine + "# Test script description" + Environment.NewLine + Environment.NewLine; // Act var result = _testUtility.ScriptTranslator.TranslateItemFilterScriptToString(script); // Assert Assert.AreEqual(expectedOutput, result); }
public void ReplaceColors_OnlyReplacesColorsWhenAllSetParametersMatched() { // Arrange var oldBackgroundColor = new Color { A = 255, R = 255, G = 0, B = 0 }; var newBackgroundColor = new Color { A = 255, R = 0, G = 255, B = 100 }; var oldTextColor = new Color { A = 255, R = 100, G = 0, B = 50 }; var newTextColor = new Color { A = 255, R = 101, G = 255, B = 51 }; var testInputReplaceColors = new ReplaceColorsParameterSet { OldBackgroundColor = oldBackgroundColor, NewBackgroundColor = newBackgroundColor, OldTextColor = oldTextColor, NewTextColor = newTextColor, ReplaceBackgroundColor = true, ReplaceTextColor = true }; var testInputBlock1 = new ItemFilterBlock(); testInputBlock1.BlockItems.Add(new BackgroundColorBlockItem(oldBackgroundColor)); testInputBlock1.BlockItems.Add(new TextColorBlockItem(oldTextColor)); var testInputBlock2 = new ItemFilterBlock(); testInputBlock2.BlockItems.Add(new BackgroundColorBlockItem(oldBackgroundColor)); testInputBlock2.BlockItems.Add(new TextColorBlockItem(new Color {A = 1, R = 2, G = 3, B = 4})); var script = new ItemFilterScript(); script.ItemFilterBlocks.Add(testInputBlock1); script.ItemFilterBlocks.Add(testInputBlock2); // Act script.ReplaceColors(testInputReplaceColors); // Assert // First test block has had its colors changed Assert.AreEqual(newBackgroundColor, testInputBlock1.BlockItems.OfType<BackgroundColorBlockItem>().First().Color); Assert.AreEqual(newTextColor, testInputBlock1.BlockItems.OfType<TextColorBlockItem>().First().Color); // Second test block has not had its colors changed Assert.AreEqual(oldBackgroundColor, testInputBlock2.BlockItems.OfType<BackgroundColorBlockItem>().First().Color); Assert.AreNotEqual(newTextColor, testInputBlock2.BlockItems.OfType<TextColorBlockItem>().First().Color); }
public void TranslateItemFilterScriptToString_OneBlock_CallsTranslator() { // Arrange var testScript = new ItemFilterScript(); var testBlock = new ItemFilterBlock(); testBlock.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.Equal, 5)); const string blockOutput = "Test Script Output"; testScript.ItemFilterBlocks.Add(testBlock); _testUtility.MockItemFilterBlockTranslator.Setup(t => t.TranslateItemFilterBlockToString(testBlock)).Returns(blockOutput).Verifiable(); // Act _testUtility.ScriptTranslator.TranslateItemFilterScriptToString(testScript); // Assert _testUtility.MockItemFilterBlockTranslator.Verify(); }
public void TranslateItemFilterScriptToString_ExtraLineBetweenBlocksSettingFalse_ReturnsCorrectOutput() { Settings.Default.ExtraLineBetweenBlocks = false; var script = new ItemFilterScript(); var block1 = new ItemFilterBlock { Description = "Test Filter 1" }; block1.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 5)); var block2 = new ItemFilterBlock(); block2.BlockItems.Add(new QualityBlockItem(FilterPredicateOperator.LessThan, 15)); block2.BlockItems.Add(new FontSizeBlockItem(7)); block2.BlockItems.Add(new WidthBlockItem(FilterPredicateOperator.Equal, 3)); script.ItemFilterBlocks.Add(block1); script.ItemFilterBlocks.Add(block2); var expectedOutput = "# Script edited with Filtration - https://github.com/ben-wallis/Filtration" + Environment.NewLine + Environment.NewLine + "# Test Filter 1" + Environment.NewLine + "Show" + Environment.NewLine + " ItemLevel > 5" + Environment.NewLine + "Show" + Environment.NewLine + " Quality < 15" + Environment.NewLine + " Width = 3" + Environment.NewLine + " SetFontSize 7" + Environment.NewLine; var blockTranslator = new ItemFilterBlockTranslator(Mock.Of <IBlockGroupHierarchyBuilder>()); var translator = CreateItemFilterScriptTranslator(itemFilterBlockTranslator: blockTranslator); // Act var result = translator.TranslateItemFilterScriptToString(script); // Assert Assert.AreEqual(expectedOutput, result); }
public void InitialiseForMasterTheme(ItemFilterScript script) { Components = script.ThemeComponents; IsMasterThemeForScript = script; _filenameIsFake = true; }
public void Validate_AtLeastOneBlock_Fail_ReturnsListWithCorrectError() { // Arrange var script = new ItemFilterScript(); // Act var result = script.Validate(); // Assert Assert.AreEqual(1, result.Count(r => r.Contains("A script must have at least one block"))); }
public void Validate_AtLeastOneBlock_Pass_ReturnsListWithoutError() { // Arrange var script = new ItemFilterScript(); script.ItemFilterBlocks.Add(new ItemFilterBlock()); // Act var result = script.Validate(); // Assert Assert.AreEqual(0, result.Count(r => r.Contains("A script must have at least one block"))); }
public void Initialise(ItemFilterScript itemFilterScript) { _replaceColorsParameterSet = new ReplaceColorsParameterSet(); _itemFilterScript = itemFilterScript; }
public void SaveItemFilterScript(ItemFilterScript script) { _fileSystemService.WriteFileFromString(script.FilePath, _itemFilterScriptTranslator.TranslateItemFilterScriptToString(script)); }