Application asks user for an input of a string, and to then replace one of the words in the string. Application returns back the newly built string with changed word
- C#
- .NET 5
- MS Test
- .NET 5 SDK
- A text editor like VS Code
- A command line interface like Terminal or GitBash to run and interact with the console app.
- Clone the repository:
$ git clone https://github.com/cass1618/FindAndReplace.Solution
- Navigate to the
FindAndReplace.Solution/
directory on your computer - Open with your preferred text editor to view the code base
- To run the console app:
- Navigate to
FindAndReplace.Solution/FindAndReplace
in your command line - Run the command
dotnet restore
to restore the dependencies that are listed in the .csproj - Run the command
dotnet build
to build the project and its dependencies into a set of binaries - Finally, run the command
dotnet run
to run the project! - Note:
dotnet run
also restores and builds the project, so you can use this single command to start the console app
- Navigate to
- To run tests:
- Navigate to
FindAndReplace.Solution/FindAndReplace.Tests
in your command line. - Run the command
dotnet restore
to restore the dependencies that are listed in the .csproj - Finally, run the command
dotnet test
to run the tests!
- Navigate to
{ [TestMethod] public void Replace_HelloWorld_HelloUniverse() { // Arrange string userString = "Hello World"; string wordToReplace = "World"; string newWord = "Universe"; Replacer testReplacer = new Replacer(); // Act string stringMethod = testReplacer.ReplacerFunction(userString, wordToReplace, newWord); string outputString = "Hello Universe"; // Assert Assert.AreEqual( outputString, stringMethod ); } }
This webpage has no known bugs.
Copywrite (c) Cassandra Copp 2021.