public void GenerateListReadmeExample() { ListFileContent <ExampleReadme> linesOfTheFile = new ListFileContent <ExampleReadme>(); linesOfTheFile.Add(new ExampleReadme { Description = "Product", Id = 1, Name = "Name", Price = 15.13M, DateAdded = new DateTime(2020, 01, 29) }); linesOfTheFile.Add(new ExampleReadme { Description = "Product", Id = 1, Name = "Name", Price = 20.95M, DateAdded = new DateTime(2020, 01, 29) }); StringBuilder correctAnswer = new StringBuilder(); correctAnswer.AppendLine($"|Product|00001|Name_____|000{(15.13).ToString("N2")}|01/29/2020|"); correctAnswer.AppendLine($"|Product|00001|Name_____|000{(20.95).ToString("N2")}|01/29/2020|"); Assert.Equal(correctAnswer.ToString(), linesOfTheFile.Generate("Product", "|", separatorAtBegining: true, separatorAtEnd: true)); }
public void GenerateReadmeExample() { ExampleReadme testObject = new ExampleReadme { Description = "Product", Id = 1, Name = "Name", Price = 15.13M, DateAdded = new DateTime(2020, 01, 29) }; ListFileContent <ExampleReadme> linesOfTheFIle = new ListFileContent <ExampleReadme>(); linesOfTheFIle.Generate("Product", "|", separatorAtBegining: true, separatorAtEnd: true); Assert.Equal($"|Product|00001|Name_____|000{(15.13).ToString("N2")}|01/29/2020|", testObject.Generate("Product", "|", separatorAtBegining: true, separatorAtEnd: true)); }