Skip to content

TWA-AFS-202210/MiniBlog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MiniBlog

Practice Requirement Fork this repository Remove duplicate code in ArticleController and UserController Make all test cases pass Environment Requirement .Net Core 6.0 Visual Studio Reference:

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-6.0 Tips: Custom TestServer:

using DependencyInjectionSample.Interfaces;
using DependencyInjectionSample.Services;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorPages();

builder.Services.AddScoped<IMyDependency, MyDependency2>();

var app = builder.Build();

In Test:

    private HttpClient GetClient()
        {
            var factory = new WebApplicationFactory<Program>();
            return factory.WithWebHostBuilder(builder =>
            {
                builder.ConfigureServices(services => { services.AddScoped(service => _articleMocker.Object); });
            }).CreateClient();
        }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages