You write a class called Wrapper, that has a single static function named wrap that takes two arguments, a string, and a column number. The function returns the string, but with line breaks inserted at just the right places to make sure that no line is longer than the column number. You try to break lines at word boundaries.
Like a word processor, break the line by replacing the last space in a line with a newline.
For example, here is a sample test case (in C#):
Wrapper.wrap("word word", 5).Should().Be("word\nword");
This boilerplate include:
- ➕ .NET 7.0 as language version
- 🧪 xUnit as testing framework
- ✅ FluentAssertions as assertion library
- 🐋 Docker as containerization platform
- Install JetBrains Rider
- Open the repository in JetBrains Rider
- Run the tests with the Test Explorer
- The tests should run and pass
- Install Visual Studio Code
- Install the C# extension
- Open the repository in Visual Studio Code
- Run the tests with the Test Explorer
- The tests should run and pass
- You can also run the tests with the command
dotnet test
in the root directory of the repository