/software_development_exercise

Software Development Exercise (bike rental library)

Primary LanguageC#

Software Development Exercise (Bike rental library)

AppVeyor Build status Travis Build Status

Follow Daniel Alvarez

This repository was implemented as an exercise for Intive-FDV, following the guidelines in this gist: https://gist.github.com/nicopaez/511f730c68aff7ff651c39223e38763f.js


Used development tools and libraries

  • Visual Studio 2015
  • NUnit for unit testing
  • Stylecop for code analysis
  • Axocover for unit test coverage
  • Log4net for logging
  • Ninject for Dependency Injection

Design

The exercise is implemented around a rental business interface declared in an Interfaces assembly. This interface is implemented in an Impl assembly, which also contains the inversion of control module used to inject the business dependency while running the library. This way, the application (in this case the unit tests), doesn't reference directly the implementation assembly, making it possible to change business implementation by changing the library, and also the configuration for injected module in app.config file. The rental domain is implemented completely in a separate assembly, so that it contains all domain classes used by the rental business. The implemented tests covers all required functionalities: Renting only one bike in three different type (by hour, day or week), and also renting bikes in family promos.

Used development practices

  • Test driven development
  • Singleton design pattern
  • Factory Method design pattern
  • Travis and AppVeyor for Continuous Integration
  • StyleCop for code analysis

How to run the tests

NUnit output

------ Run test started ------
 NUnit Adapter 3.7.0.0: Test execution started
 Running all tests in C:\git\software_development_exercise\BikeRental.Tests\bin\Debug\BikeRental.Tests.dll
 NUnit3TestExecutor converted 27 of 27 NUnit test cases
 NUnit Adapter 3.7.0.0: Test execution complete
========== Run test finished: 27 run (0:00:18,3110473) ==========

AxoCover Tests result

nunit

AxoCover Coverage report

cover

StyleCop analysis result

------ StyleCop 5.0 (build 5.0.6329.1) started ------

Pass 1:   BikeRental.Tests - \Properties\AssemblyInfo.cs
Pass 1:   BikeRental.Tests - \RentalBusinessTests_ByDay.cs
Pass 1:   BikeRental.Tests - \RentalBusinessTests_ByHour.cs
Pass 1:   BikeRental.Tests - \RentalBusinessTests_ByWeek.cs
Pass 1:   BikeRental.Tests - \RentalBusinessTests_FamilyPromo.cs
Pass 1:   BikeRental.Tests - \RentalBusinessTests_NonExisting.cs
Pass 1:   BikeRental.Domain - \Exceptions\InvalidRentalsCountException.cs
Pass 1:   BikeRental.Domain - \Exceptions\NonExistingBikeException.cs
Pass 1:   BikeRental.Domain - \Exceptions\NonExistingPromoException.cs
Pass 1:   BikeRental.Domain - \Prices.cs
Pass 1:   BikeRental.Domain - \Promo.cs
Pass 1:   BikeRental.Domain - \Properties\AssemblyInfo.cs
Pass 1:   BikeRental.Domain - \Rental.cs
Pass 1:   BikeRental.Domain - \RentalByDay.cs
Pass 1:   BikeRental.Domain - \RentalByHour.cs
Pass 1:   BikeRental.Domain - \RentalByWeek.cs
Pass 1:   BikeRental.Domain - \RentalType.cs
Pass 1:   BikeRental.Impl - \BikeRentalBusiness.cs
Pass 1:   BikeRental.Impl - \BikeRentalIoCModule.cs
Pass 1:   BikeRental.Impl - \Properties\AssemblyInfo.cs
Pass 1:   BikeRental.Interfaces - \IBikeRentalBusiness.cs
Pass 1:   BikeRental.Interfaces - \Properties\AssemblyInfo.cs

------ StyleCop completed ------

========== Violation Count: 0 ==========