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 #77

Closed

Conversation

@Cooperwutzke
Copy link

Cooperwutzke commented Feb 4, 2020

Here is my Assignment 4

@StevenZuelke

This comment has been minimized.

Copy link

StevenZuelke commented Feb 4, 2020

I will review this

Copy link

StevenZuelke left a comment

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 approprietly
  • Mocking framework used to create the test doubles
@@ -2,8 +2,17 @@

<PropertyGroup>
<Nullable Condition="$(Nullable)==''">enable</Nullable>
<IncludeOpenAPIAnalyzers>true</IncludeOpenAPIAnalyzers>

This comment has been minimized.

Copy link
@StevenZuelke

StevenZuelke Feb 4, 2020

Enabled WebAnalyzers good

services.AddScoped<IGiftService, GiftService>();
services.AddScoped<IGroupService, GroupService>();
services.AddScoped<IUserService, UserService>();
Comment on lines +33 to +35

This comment has been minimized.

Copy link
@StevenZuelke

StevenZuelke Feb 4, 2020

Services Registered with correct scopes

SqliteConnection sqliteConnection = new SqliteConnection("DataSource=:memory:");

sqliteConnection.Open();
services.AddDbContext<ApplicationDbContext>(options =>

This comment has been minimized.

Copy link
@StevenZuelke

StevenZuelke Feb 4, 2020

Added Db Context


System.Type profileType = typeof(AutomapperConfigurationProfile);
System.Reflection.Assembly assembly = profileType.Assembly;
services.AddAutoMapper(new[] { assembly });

This comment has been minimized.

Copy link
@StevenZuelke

StevenZuelke Feb 4, 2020

Added Automapper

services.AddAutoMapper(new[] { assembly });
services.AddMvc(opts => opts.EnableEndpointRouting = false);

services.AddSwaggerDocument();

This comment has been minimized.

Copy link
@StevenZuelke

namespace SecretSanta.Api.Controllers
{
[Route("api/[controller]")]

This comment has been minimized.

Copy link
@StevenZuelke

StevenZuelke Feb 4, 2020

Got your CRUD operations. Well done using an entity interface for all three controllers

[TestMethod]
public void Create_EntityController_Success()
{

This comment has been minimized.

Copy link
@StevenZuelke

StevenZuelke Feb 4, 2020

Nothing here

This comment has been minimized.

Copy link
@Keboo

Keboo Feb 10, 2020

Collaborator

Agreed.

return Task.FromResult(Items[id]);
}

public Task<TEntity?> UpdateAsync(int id, TEntity entity)

This comment has been minimized.

Copy link
@StevenZuelke

StevenZuelke Feb 4, 2020

Test all CRUD operations, good

Copy link
Collaborator

Keboo left a comment

(Cooperwutzke)

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 ✔
static public Gift CreateGift2() => new Gift(Title2, Url2, Desc2, CreatePrincessButtercup());

// Group 1
public const String GroupTitle1 = "GroupTitle1";

This comment has been minimized.

Copy link
@Keboo

Keboo Feb 10, 2020

Collaborator

Use keyword instead of type name

static public Group CreateGroup1() => new Group(GroupTitle1);

// Group2
public const String GroupTitle2 = "GroupTitle2";

This comment has been minimized.

Copy link
@Keboo

Keboo Feb 10, 2020

Collaborator

Use keyword instead of type name

CreateMap<User, User>().ForMember(property => property.Id, option => option.Ignore());
CreateMap<Gift, Gift>()
.ForMember(property => property.Id, option => option.Ignore())
.ForMember(property => property.CreatedBy, option => option.Ignore());

This comment has been minimized.

Copy link
@Keboo

Keboo Feb 10, 2020

Collaborator

Though this solution certainly works to make the unit tests happy, it does expose some problems. For example it still allows someone outside of the data layer to directly modify the finger printing properties (which really should be completely controlled in the data layer). You can see a solution in the Assignment4Complete branch.

[TestMethod]
public void Create_EntityController_Success()
{

This comment has been minimized.

Copy link
@Keboo

Keboo Feb 10, 2020

Collaborator

Agreed.

@Keboo Keboo closed this Feb 10, 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.