Skip to content

lukeshepard21/CMAPTechTest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Timesheet System

Project Overview

The Timesheet System is an ASP.NET MVC application designed for tracking work hours across projects. Developed with a Test-Driven Development (TDD) approach, this application ensures reliable functionality for entering, managing, and exporting timesheet data, with built-in validation and automated tests.

Project Structure

The application is organized into the following core directories:

  • Controllers: Manages HTTP requests, directs data flow, and renders views.
  • Models: Defines data structures, including the primary TimesheetEntry model.
  • Views: Contains Razor views that define the user interface.
  • Services: Implements core functionality such as data processing and business logic.
  • Tests: Houses unit tests developed through TDD to ensure functionality across the application.

Features and Development Process

This project was developed using a Test-Driven Development (TDD) approach. Below is an outline of the primary features and their development process:

Section 1: TimesheetEntry Model and In-Memory Data Storage

  1. Model Definition

    • Created the TimesheetEntry model with key properties: UserName, Date, ProjectName, Description, and HoursWorked.
    • Wrote unit tests to verify that each property is correctly defined and accessible.
  2. In-Memory Database (TimesheetService)

    • Implemented TimesheetService to simulate data storage in an in-memory database.
    • Created tests to validate all CRUD operations and to ensure accurate total hours calculation.

Section 2: Core Functionality for Timesheet Entry

  1. Timesheet Entry Form and Listing

    • Developed the timesheet entry form and listing view to allow users to add and view timesheet entries.
    • Added controller tests to confirm functionality for adding and retrieving entries.
  2. Form Validation

    • Implemented validation to restrict HoursWorked to a maximum of 24 hours and ensure Description is not empty.
    • Created validation tests to ensure inputs meet these criteria.

Section 3: Daily Total Hours Calculation

  • Enhanced hour calculation logic to aggregate total hours per user and day.
  • Added tests to confirm accurate calculations, even with multiple entries on the same date.

Section 4: CSV Export Functionality

  1. CSV Export Logic

    • Developed logic to export timesheet data to a CSV format, ensuring data integrity and accurate aggregation of total hours.
    • Created tests to validate CSV file structure, headers, and aggregation.
  2. Export View

    • Added an "Export to CSV" button in the listing view to enable users to download timesheet data.

Section 5: Unit Testing Coverage

  1. TimesheetService Tests

    • Verified comprehensive test coverage for all CRUD and calculation operations.
    • Added edge case tests to cover scenarios like single vs. multiple entries and various user/date combinations.
  2. CSV Export Tests

    • Verified that the CSV export tests cover structure, headers, and aggregation accuracy.

Test-Driven Development (TDD) Approach

Each feature was implemented using TDD as follows:

  1. Write Tests First
    Tests were written first to define expected functionality, setting clear requirements before coding.

  2. Code Implementation
    Code was then written to pass the tests, ensuring functionality adhered to test specifications.

  3. Refinement and Optimization
    Once tests were passing, the code was refined and optimized while maintaining functionality.

Documentation and Final Testing

  1. Code Documentation

    • Inline comments were added throughout the codebase to explain key functionalities and design choices.
  2. Manual Testing

    • In addition to automated tests, manual testing was conducted to confirm UI elements and CSV export accuracy.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors