public void AndreiPlaylist() { IReceive r = null; IDataToSent data = null; $"when I create a recipe with jenkins".w(() => r = new RecipeFromFilePath("Assets/recipes/youtubeplaylist.txt")); $"and I transform".w(async() => data = await r.TransformData(null)); $" there should be >50 links".w(() => { data.DataToBeSentFurther.Should().NotBeNull(); data.DataToBeSentFurther.Count.Should().Be(2); var sumRows = data.DataToBeSentFurther.Select(it => it.Value.Rows.Count).Sum(); sumRows.Should().BeGreaterThan(50); }); }
public void ObtainExchangeRatesInRecipesFromFile(string fileName, int NumberRows, string currencyName, string ValueName, string valueEur) { string s = $"ReceiverXML file={fileName} xpath=//*[name()='Rate']"; s += Environment.NewLine; s += $"#just a comment"; s += Environment.NewLine; s += $"TransformerXMLToColumn columnName=OuterXML xPath=//@{currencyName} newColumnName={currencyName}"; s += Environment.NewLine; s += $"FilterRemoveColumn nameColumn=OuterXML"; s += Environment.NewLine; s += $"FilterRemoveColumn nameColumn=Name"; s += Environment.NewLine; s += $"SenderOutputExcel fileName=a.xlsx"; s += Environment.NewLine; s += $"SenderOutputToFolder folderToSave=exports addKey=false"; System.IO.File.WriteAllText("myRecipe", s); IReceive receiver = null; IDataToSent data = null; $"Given the recipe {s} ".w(() => { File.Exists(fileName).Should().BeTrue(); }); $"When I create the r{nameof(RecipeFromFilePath)} ".w(() => receiver = new RecipeFromFilePath("myRecipe")); $"And I read the data".w(async() => data = await receiver.TransformData(null)); $"the table should contain {nameof(currencyName)}".w(() => data.Metadata.Columns.FirstOrDefault(it => it.Name == currencyName).Should().NotBeNull()); $"the table should contain {nameof(ValueName)}".w(() => data.Metadata.Columns.FirstOrDefault(it => it.Name == ValueName).Should().NotBeNull()); $"and the data should contain for EUR {nameof(valueEur)}".w(() => { DataView dv = new DataView(data.DataToBeSentFurther[1]) { RowFilter = $"{currencyName}='EUR'" }; dv.Count.Should().Be(1); DataRow row = dv[0].Row; row[ValueName].ToString().Should().Be(valueEur); }); $"and should be just 2 columns".w(() => data.DataToBeSentFurther[0].Columns.Count.Should().Be(2)); }