An basic monthly premium calculator project using C#, .NET Core, React, JavaScript, Materail-ui, HTML5, CSS3, xUnit.net, Moq and InMemoryDatabase for more efficient unit testing.
Application is hosted in Azure - Pending
Steps of installation
- Import project into Visual Studio (or alternative IDE Visual Studio Code)
- Build the Whoel Monthly Premium Solution, it will resolve backend and forntend dependencies. VS code need to have install depencies manually or use command "dotnet build" in terminal of the Web Project path.
- Select the Web Project as the startup Project
- Run the Application (Visual Studio - preferably VS 2019 Community edition). VS code use "dotnet run"
Monthly Premium Calculator feature
- Screens - Monthly Premium.
- Built 5 different projects libraries
- Web - responsible for the UI (i.e Client application - React SPA, Materail-UI) coordinated by controllers which execute around 3 different User stories.
- Domain - This is the Domain centric with no implementation and just Entities.
- Services - Application Service layer which implements contracts and abstracts calls to Repository layer.
- Repository - A Persitence layer with the idea of abstracting the data access concerns and option to use preferred data access technology.
- Tests(28) - Unit & Integration tests using xUnit.net, Moq and InMemoryDatabase for more efficient unit testing and used TestHost for TestFixture. Unit test for React app is pending.
- Application deployed in Azure - https://monthlypremiumcalculator.azurewebsites.net/
Application structure results in following:
- Independent of Frameworks - Core should not be dependent on external frameworks such as Entity Framework
- Testable - The logic within Core can be tested independently of anything external, such as UI, databases, servers. Without external dependencies, the tests are very simple to write.
- Independent of UI - It is easy to swap out the Web UI for a Console UI, or Angular for Vue. Logic is contained within Core, so changing the UI will not impact logic.
- Independent of Database - You might choose SQL Server or Oracle, but as of now am using InMemoryDatabase for more efficient unit testing
- Independent of anything agency - Core simply doesn't know anything about the outside world
- As a Member I would like to have an ability to choose various options on the screen So that I can view the monthly premiums calculated and displayed on the screen
Acceptance Criteria:
- User can input all the values like Name, Date of Birth (DOB), Death Sum Insured and Occupation. For MVP, there is no upper limit the Sum Insured.
- When User should be allowed DOB right from age 1 to till 120 years.
- User can input any amount of Sum Insured with no upper limit
- User is provided with very selective Occupations and based on those occupations there are Rating and Factors to calculate the monthly Premium, based on Test Data shown (TestData Image) at the bottom
- Once the user selects Occupation along with other valid inputs and submits Calculate button Given User selects "Doctor" as occupation When User clicks Calculate button Then In the backend the Doctor's rating i.e Professional and Factor of 1.0 teh calulation is done When All input is validated the formula used is "Death Premium = (Death Cover amount * Occupation Rating Factor * Age) /1000 * 12" Then The calculated premium is returned back to UI to user
- Given all the input fields are specified, change in the occupation dropdown should trigger the premium calculation
Given User selects any(other than "None") occupation dropdown
When All the input fields have valid and expected values
Then The POST request is submitted to the backend And The calculated premium is returned back to UI to user But If any of the input fields have invalid data error message should be shown and not submitted.