Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment4 #86

Closed
Closed

Conversation

@kenny2892
Copy link

kenny2892 commented Feb 4, 2020

Assignment 4

@JeffreyNix

This comment has been minimized.

Copy link

JeffreyNix commented Feb 6, 2020

I will code review this

@JeffreyNix

This comment has been minimized.

Copy link

JeffreyNix commented Feb 6, 2020

Assignment 4

For this assignment you will be setting up the SecretSanta.Api project.

  • Enable WebAPI analyzers and handle all warnings.
    Add the following to SecretSanta.Api to enable
<PropertyGroup>
 <IncludeOpenAPIAnalyzers>true</IncludeOpenAPIAnalyzers>
</PropertyGroup>
  • Setup dependency injection and register all relevant services✔

    • Ensure all relevant services are registered with appropriate scopes✔
    • Ensure DB context is registered✔
    • Ensure AutoMapper is registered✔
  • Apply NSwag to the project and ensure that the swagger page is able to invoke your endpoints. It is ok if invoking the endpoints causes errors due to the use of the SecretSanta.Data classes.✔

  • Setup the Api project with three controllers (GiftController, GroupController, UserController)✔
    love the use of generics

    • Each controller should take in a service as a constructor dependency.✔
    • For now the return types from the controller methods can use the data objects from SecretSanta.Data (we will be fixing this next week).✔
    • Create CRUD (Create/Read/Update/Delete) endpoints on all of the controllers using appropriate HTTP verbs✔
    • Where relevant, apply ProducesResponseTypeAttributes to the controller methods.
      anytime you use Ok() or NotFound() this means the method produces a response type and it should be flagged
  • Unit test the controllers✔

    • The goal is to simply unit test the code in the controllers. These unit tests should not need to interact with the services.✔
    • Unit tests should use "test doubles" to satisfy the service dependencies.✔

Extra Credit

  • There are two commented out tests in EntityServiceTests that are failing due to CreatedBy being overwritten. The solution should either be done inside of the AutoMapper configuration, or inside of the AddFingerPrinting() to prevent this value from changing once it has been set. Simply fix the unit tests.
  • Creating test doubles can be strealined by using a mocking framework (such as Moq). Rather than writing your own test doubles use a mocking framewokr to create them.✔
Copy link
Collaborator

Keboo left a comment

(kenny2892)

Assignment4

Project Analysis Summary
Nullable Enabled:
Unexpected Disabled Warnings:
Appropriately handle all warnings:
ProjectName Nullable Solutions Analyzers Unexpected Disabled Warnings Waning Level
SecretSanta.Api Enable SecretSanta.sln IntelliTect Analyzers, Microsoft CodeQuality Analyzers, Microsoft .NET Core Analyzers, Microsoft .NET Framework Analyzers, Microsoft.CodeAnalysis.Analyzers, Microsoft.CodeAnalysis.CSharp.Analyzers, Microsoft.CodeAnalysis.VersionCheckAnalyzer, Microsoft.EntityFrameworkCore.Analyzers 4
SecretSanta.Business Enable SecretSanta.sln IntelliTect Analyzers, Microsoft CodeQuality Analyzers, Microsoft .NET Core Analyzers, Microsoft .NET Framework Analyzers, Microsoft.CodeAnalysis.VersionCheckAnalyzer, Microsoft.EntityFrameworkCore.Analyzers 4
SecretSanta.Data Enable SecretSanta.sln IntelliTect Analyzers, Microsoft CodeQuality Analyzers, Microsoft .NET Core Analyzers, Microsoft .NET Framework Analyzers, Microsoft.CodeAnalysis.VersionCheckAnalyzer, Microsoft.EntityFrameworkCore.Analyzers 4
SecretSanta.Web Enable SecretSanta.sln IntelliTect Analyzers, Microsoft CodeQuality Analyzers, Microsoft .NET Core Analyzers, Microsoft .NET Framework Analyzers, Microsoft.CodeAnalysis.VersionCheckAnalyzer 4
SecretSanta.Api.Tests Enable SecretSanta.sln IntelliTect Analyzers, Microsoft CodeQuality Analyzers, Microsoft .NET Core Analyzers, Microsoft .NET Framework Analyzers, Microsoft.CodeAnalysis.Analyzers, Microsoft.CodeAnalysis.CSharp.Analyzers, Microsoft.CodeAnalysis.VersionCheckAnalyzer, Microsoft.EntityFrameworkCore.Analyzers 4
SecretSanta.Business.Tests Enable SecretSanta.sln IntelliTect Analyzers, Microsoft CodeQuality Analyzers, Microsoft .NET Core Analyzers, Microsoft .NET Framework Analyzers, Microsoft.CodeAnalysis.VersionCheckAnalyzer, Microsoft.EntityFrameworkCore.Analyzers 4
SecretSanta.Data.Tests Enable SecretSanta.sln IntelliTect Analyzers, Microsoft CodeQuality Analyzers, Microsoft .NET Core Analyzers, Microsoft .NET Framework Analyzers, Microsoft.CodeAnalysis.VersionCheckAnalyzer, Microsoft.EntityFrameworkCore.Analyzers 4
SecretSanta.Web.Tests Enable SecretSanta.sln IntelliTect Analyzers, Microsoft CodeQuality Analyzers, Microsoft .NET Core Analyzers, Microsoft .NET Framework Analyzers, Microsoft.CodeAnalysis.VersionCheckAnalyzer 4

Main Assignment

  • WebAPI Analyzers enabled ✔
  • DI properly configured ✔
  • Services properly registered with correct scopes ✔
  • DB context properly registered ✔
  • AutoMapper properly registered ✔
  • NSwag properly setup ✔
  • API controllers properly expose CRUD operations ✔
  • Controllers are all unit tested ✔

Extra Credit

  • Unit tests in EntityServiceTests fixed appropriately
  • Mocking framework used to create the test doubles ✔

Peer Review

  • On time ✔
  • Accurate ✔
  • Appropriate comments given ✔
@@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Nullable>enable</Nullable>
<IncludeOpenAPIAnalyzers>true</IncludeOpenAPIAnalyzers>

This comment has been minimized.

Copy link
@Keboo

Keboo Feb 11, 2020

Collaborator

This certainly woks, but outside of web projects it does not add any value

@Keboo Keboo closed this Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.