Skip to main content

Posts

Showing posts from May, 2022

A Demo In .NET6 Mock HttpClient Using XUnit

In this article, we are going to test our HttpClient instance in .NET6 application by mocking it using the XUnit. Click here for .NET6 Web API Unit testing using XUnit that covers testing for 'Controllers', 'Service Logic', 'Entity framework Core Database Context'. Create An API And Unit Test Project: Let's create a .Net6 Web API and xUnit sample applications to accomplish our demo. We can use either Visual Studio 2022 or Visual Studio Code(using .NET CLI commands) to create any.Net6 application. For this demo, I'm using the 'Visual Studio Code'(using the .NET CLI command) editor. Create a folder where we want to set up our applications. Then add a solution file by running the below command. Command To Add Solution File: dotnet new sln -n Name_of_your_solution_file Now let's create a .NET6 Web API project. dotnet new webapi -o Name_of_your_API_project Now let's create xUnit project. dotnet new xunit -o Name_of_your_API_project No

A CRUD Operation Demo On NestJS Using Azure Cosmos DB

In this article, we are going to implement  CRUD operations into the NestJS application using Azure Cosmos DB. Azure Cosmos DB: Azure Cosmos DB is a fully managed NoSQL database. NoSQL says data will be stored as a key/value JSON document. Cosmos DB provides 'High Availability' and 'Low Latency' for any application. Cosmos DB is very quick in response delivering, auto-scaling, effective auto failure management, etc. Any existing application that works on different DBs can be easily migrated to Azure CosmosDB as it provides APIs for integration like 'SQL/Core API'(most recommended API, our demo uses this 'SQL/Core API'), 'MongoDB API', 'Cassandra API', 'Germlin API', 'Table API'. Let's understand the structure of the Cosmos DB: Create an Azure Cosmos Account with an appropriate subscription inside of the Azure portal. After creating the Cosmos Account, we can manage the data of our account by creating 'Database'

A Demo To Consume Azure Cosmos DB By .Net6 Web API

In this article, we will implement a .NET6 Web API that consumes the Azure Cosmos DB. Azure CosmosDB: Azure Cosmos DB is a fully managed NoSQL database. NoSQL says data will be stored as a key/value JSON document. Cosmos DB provides 'High Availability' and 'Low Latency' for any application. Cosmos DB is very quick in response delivering, auto-scaling, effective auto failure management, etc. Any existing application that works on different DBs can be easily migrated to Azure CosmosDB as it provides APIs for integration like 'SQL/Core API'(most recommended API, our demo uses this 'SQL/Core API'), 'MongoDB API', 'Cassandra API', 'Germlin API', 'Table API'. Let's understand the structure of the Cosmos DB: Create an Azure Cosmos Account with an appropriate subscription inside of the Azure portal. After creating the Cosmos Account, we can manage the data of our account by creating 'Database', 'Containers', an