For ASP.NET Core, the _________ attribute helps in grouping multiple related test methods.
- [TestClass]
- [TestGroup]
- [TestMethodGroup]
- [TestGrouping]
In ASP.NET Core, the [TestClass] attribute is used to define a test class, and it helps in grouping multiple related test methods within that class. Grouping makes it easier to organize and run tests, especially when dealing with a large number of tests in a project.
If you want to serve static files in ASP.NET Core, you need to use the _______ middleware.
- StaticFiles
- Routing
- Authentication
- DependencyInjection
In ASP.NET Core, serving static files like HTML, CSS, JavaScript, and images is accomplished using the StaticFiles middleware. This middleware allows you to efficiently serve these files directly without going through the MVC routing system.
In the context of Razor views, which directive would you use in _ViewImports.cshtml to define a shared model type across views?
- @model
- @inherits
- @using
- @namespace
To define a shared model type across Razor views, you would use the @inherits directive in the _ViewImports.cshtml file. This directive specifies the base class for all views in the directory, allowing you to set a common model type for those views.
In which file or method is the exception handling middleware typically configured in an ASP.NET Core application?
- Startup.cs -> ConfigureServices
- appsettings.json
- Program.cs -> Main method
- HomeController.cs
In an ASP.NET Core application, the exception handling middleware is typically configured in the Startup.cs file, specifically in the ConfigureServices method, where services like UseExceptionHandler or UseDeveloperExceptionPage are added to the middleware pipeline.
You're deploying your ASP.NET Core application on Azure. To monitor the application's performance and health, which Azure service can you use?
- Azure Monitor
- Azure Functions
- Azure Storage
- Azure Machine Learning
Azure Monitor is the Azure service designed for monitoring and gaining insights into the performance, health, and usage of applications deployed on Azure, including ASP.NET Core applications. It provides comprehensive monitoring and diagnostic capabilities.
To create users in ASP.NET Core Identity, developers typically interact with the _________ class.
- ApplicationUser
- UserManager
- UserFactory
- IdentityUser
To create users in ASP.NET Core Identity, developers typically interact with the 'UserManager' class. The 'UserManager' provides methods for user management, including user creation, deletion, and more.
You're developing a backend service for a mobile app that will only return JSON data. Which ASP.NET Core template should you start with?
- MVC
- Razor Pages
- Web API
- Blazor Server
When developing a backend service that exclusively returns JSON data for a mobile app, you should start with the Web API template. Web API is specifically designed for building RESTful services that can provide data in formats like JSON, making it a suitable choice for this scenario.
For ASP.NET Core, what tool can be utilized to measure the coverage of your unit tests?
- MSTest
- xUnit
- NUnit
- OpenCover
OpenCover is a popular tool used for measuring code coverage in ASP.NET Core projects. It provides insights into which parts of your codebase are covered by unit tests, helping you identify areas that may need additional testing.
After writing your ASP.NET Core application code, you want to build and run your application using a command-line tool. Which tool would you use for this purpose?
- .NET CLI (Command Line Interface)
- Git Bash
- PowerShell
- Command Prompt
To build and run your ASP.NET Core application from the command line, you would use the .NET CLI (Command Line Interface). It's a powerful tool that provides various commands for managing and running your ASP.NET Core projects efficiently.
Shared Razor directives that are intended to be used across several views in an ASP.NET Core application are typically placed in the _______.cshtml file.
- _ViewImports
- _Layout
- _Partial
- _ViewStart
Shared Razor directives that are meant to be used across multiple views are typically placed in the _ViewStart.cshtml file. This file is executed before any view is rendered and allows you to set common layout or content directives for all views.