Skip to content

C# test-driven development independent project for Epicodus

Notifications You must be signed in to change notification settings

michelle-morin/WordCounter.Solution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Word Counter

C# Independent Project for Epicodus, Mar. 6, 2020

By Michelle Morin

Description

This project (accessible on Github) is a console application that gathers both a word and a sentence from a user, then checks how frequently the word appears in the sentence. The application checks for full word matches only (e.g., if provided the word "cat" and the sentence "I'm walking the cat to the cathedral", the first three letters of the word cathedral would not be counted.

Specifications:

Specification Example Input Example Output Explanation of Selected Input Values
Application takes input of a word and returns error message when the input is more than one word (contains spaces) "hello there" "invalid input" This input value includes one space and thus is easily rejected by the sentence validation method.
Application takes input of a word and returns the word in lowercase form when the input is a single word (does not contain spaces) "Hello" "hello" This input value includes one capital letter and thus provides a clear pass/fail depending upon whether the "H" is lowercased.
Application removes symbols (such as punctuation) from input word "cat!" "cat" This input value includes a single punctuation at the end of the word
Application takes input of a sentence and returns an error message when the input sentence does not contain spaces between words (i.e., is a single word, whitespace, or null) "cat" "invalid input" This input value is a single word.
Application takes input of a sentence and returns the sentence in lowercase form when the input sentence contains at least one space (i.e., more than one word) "Hello There" "hello there" This input includes two words with a single capital letter, and thus provides a clear pass/fail based upon whether the "H" is lowercased.
If sentence is a valid sentence, the application removes all punctuation from input sentence before lowercasing sentence "The cat walked." "the cat walked" This input includes only one punctuation mark to remove.
Application splits sentence into array of individual words (delimited by spaces) and, for each word of the sentence that matches the input word, adds the matching word to a static list "cat", "I'm walking the cat to the cathedral" static List contains one string There is only one occurance of the input word "cat" in this input sentence, and the sentence includes another partial match (cathedral), so this test should also ensure the application accepts only complete matches.

In addition to the above specifications, the application implements the following UI behaviors:

  • When input sentence does not include any words matching the input word, the application returns a message indicating no matches were found (e.g., input word: "hello", input sentence: "the weather is great today" would result in output of: "The sentence {the weather is great today} does not include word {hello}").
  • When the input sentence does include a word(s) matching the input word, the application returns a message indicating the number of matches found (e.g., input word: "cat", input sentence: "i walked the cat" would result in the output: "the number of times the word {cat} appears in the sentence {i walked the cat} is {1}!").

Setup/Installation Requirements

Install .NET Core

on macOS:

  • Click here to download a .NET Core SDK from Microsoft Corp.
  • Open the file (this will launch an installer which will walk you through installation steps. Use the default settings the installer suggests.)

on Windows:

  • Click here to download the 64-bit .NET Core SDK from Microsoft Corp.
  • Open the .exe file and follow the steps provided by the installer for your OS.

Install dotnet script

Enter the command dotnet tool install -g dotnet-script in Terminal (macOS) or PowerShell (Windows).

Clone this repository

Enter the following commands in Terminal (macOS) or PowerShell (Windows):

  • cd desktop
  • git clone https://github.com/michelle-morin/WordCounter.Solution
  • cd WordCounter.Solution

Confirm that you have navigated to the WordCounter.Solution directory (e.g., by entering the command pwd in Terminal).

To view/edit the source code of this application, open the contents of the WordCounter.Solution directory in a text editor or IDE of your choice (e.g., to open all contents of the directory in Visual Studio Code on macOS, enter the command code . in Terminal).

Run this console application by entering the following commands in Terminal (macOS) or PowerShell (Windows):

  • cd WordCounter
  • dotnet run

Test this console application by entering the following commands in Terminal (macOS) or PowerShell (Windows):

  • cd WordCounter.Tests
  • dotnet restore
  • dotnet test

Technologies Used

  • Git
  • C#
  • .NET Core 2.2
  • dotnet script
  • MSTest

License

This webpage is licensed under the MIT license.

Copyright (c) 2020 Michelle Morin

About

C# test-driven development independent project for Epicodus

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages