Skip to content

mpbmpb/stopwatch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coverage Tests GitHub code size in bytes Contributors Stargazers Issues MIT License LinkedIn


Stopwatch




A coding exercise from the udemy course C# intermediate

Report Bug · Request Feature

Table of Contents

About The Project

This is a short console app written as an exercise given in de udemy course C# Intermediate by Mosh Hamedani.
It is a simple stopwatch app with a short test that prints to the console.

I wrote all of the exercises for this course using the TDD approach of writing tests first and then production code. The tests are written using xUnit and Fluent Assertions.

Thank you Mosh Hamedani for making a comprehensive and easy to follow course. ⭐

A list of commonly used resources that I found helpful are listed in the acknowledgements.

Built With

The code was written in Visual Studio.
The test coverage was measured with JetBrains dotCover.

Specifications

The given specifications were:

  • Design a class called Stopwatch. The job of this class is to simulate a stopwatch. It should provide two methods: Start and Stop. We call the start method first, and the stop method next. Then we ask the stopwatch about the duration between start and stop. Duration should be a value in TimeSpan. Display the duration on the console.

  • We should also be able to use a stopwatch multiple times. So we may start and stop it and then start and stop it again. Make sure the duration value each time is calculated properly.

  • We should not be able to start a stopwatch twice in a row (because that may overwrite the initial start time). So the class should throw an InvalidOperationException if its started twice.

What I learned from this project

How to use DateTime and TimeSpan.

Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

Visual Studio needs to be installed along with the dotnet core runtime and SDK All can be installed by the Visual Studio installer.

  • The installer can be found on this page
[Visual Studio documentation](https://docs.microsoft.com/en-us/visualstudio/install/install-visual-studio?view=vs-2019)

Installation

  1. Open Terminal
  2. Navigate to the directory where you want to install the files
  3. Clone the repo
git clone https://github.com/mpbmpb/stopwatch.git
  1. go to the stopwatch directory
cd stopwatch
  1. run the app from the terminal
dotnet run
  1. or find the stopwatch.sln file in your explorer and double click it. Visual Studio should take it from there.

Usage

This project is meant purely as an educational exercise.

Roadmap

There are currently no plans to expand this project. Feel free to contribute if you want to add something.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Feel free to contact me if you have questions or suggestions.

Mark van den Beemt - markkeyster@gmail.com

Project Link: https://github.com/mpbmpb/stopwatch

Acknowledgements

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages