Book Image

Distributed .NET with Microsoft Orleans

By : Bhupesh Guptha Muthiyalu, Suneel Kumar Kunani
Book Image

Distributed .NET with Microsoft Orleans

By: Bhupesh Guptha Muthiyalu, Suneel Kumar Kunani

Overview of this book

Building distributed applications in this modern era can be a tedious task as customers expect high availability, high performance, and improved resilience. With the help of this book, you'll discover how you can harness the power of Microsoft Orleans to build impressive distributed applications. Distributed .NET with Microsoft Orleans will demonstrate how to leverage Orleans to build highly scalable distributed applications step by step in the least possible time and with minimum effort. You'll explore some of the key concepts of Microsoft Orleans, including the Orleans programming model, runtime, virtual actors, hosting, and deployment. As you advance, you'll become well-versed with important Orleans assets such as grains, silos, timers, and persistence. Throughout the book, you'll create a distributed application by adding key components to the application as you progress through each chapter and explore them in detail. By the end of this book, you'll have developed the confidence and skills required to build distributed applications using Microsoft Orleans and deploy them in Microsoft Azure.
Table of Contents (17 chapters)
1
Section 1 - Distributed Applications Architecture
4
Section 2 - Working with Microsoft Orleans
10
Section 3 - Building Patterns in Orleans
13
Section 4 - Hosting and Deploying Orleans Applications to Azure

Understanding unit testing in Orleans

In this section, we will see how to do unit testing on Orleans grains and ensure they are working fine. Orleans has a NuGet package called Microsoft.Orleans.TestingHost, which can be used to create an in-memory cluster with two silos by default to test your grains. Let's now, step by step, create the unit test project and add tests to test the Grains output. Orleans grains are in many ways their own little domains and the goal of unit testing is to make sure each of the grains as a unit behaves correctly.

Step 1: Create the unit test project:

  1. Add a unit test project to your solution using the xUnit Test Project template as shown here:

Figure 7.10 – Unit test project template

  1. Name the unit test project Distel.UnitTests:

Figure 7.11 – Unit test project template

Step 2: Install the TestingHost NuGet package and configure the silo:

  1. Install the Microsoft...