skip to Main Content

Asp.net – Need to update .NET Core version for 6.0

I update my.NET Core Version from the previous version to .NET Core Version 6.0 in visual studio 2022 & update the required packages for my project. But in Program.cs I got the below warning. Warning:'ApplicationInsightsWebHostBuilderExtensions.UseApplicationInsights(IWebHostBuilder)' is obsolete: 'This method is…

VIEW QUESTION

Asp.net – Flexible way to handle exception in Web API

I'm currently making a web API with .NET 6. The code bellow is my Exception handler class: public class ExceptionsMiddleware { private readonly RequestDelegate requestDelegate; private readonly ILogger<ExceptionsMiddleware> logger; public ExceptionsMiddleware(RequestDelegate requestDelegate, ILogger<ExceptionsMiddleware> logger) { this.requestDelegate = requestDelegate; this.logger =…

VIEW QUESTION

Asp.net – How to mock dependency of service that has fuction with argument in type of 'async Function'?

I have a function here that is for getting the logs in the queue. How can I mock this function for unit testing ? void QueueBackgroundWorkItem(Func<CancellationToken, IServiceProvider, Task> workItem); Mock<IBackgroundTaskQueue> _Mock= new Mock<IBackgroundTaskQueue>(); _Mock.Setup(x=>x.QueueBackgroundWorkItem(?)).Returns(Task.CompletedTask); Thank you.

VIEW QUESTION
Back To Top
Search