Step-by-Step Guide
Set Up Your Environment:
Ensure you have Visual Studio installed.
Install the necessary NuGet packages: Moq and xUnit.
Create Your Database Mock:
Use Moq to create a mock database context.
Write Your Unit Test: Define
your test cases using the xUnit framework.
Use the mock objects to simulate database interactions.
Example
Let's say you have a function GetUserById t...
[More]
Cloud era do We need OO?
This is q good question. We have a lot scripting framework that can be used to develop sophisticated web. We have low level codes that can help build an app within a minute. We have cloud template to deploy solution in minutes. Do we still need Object Oriented (OO)? The answer is it depends.
When you build a game, you might need OO. In example, unity project needs C# s...
[More]
Video game development in Visual Studio
Microsoft loves video games. Xbox, Game Pass, and DirectX is a real proof that Microsoft is committed to video game. As a result, we see a lot opportunity to build video game in any platform with Microsoft Based technology. You can see a specific section namely gaming. Microsoft has two categories: Game Development with Unity (C#) and Game Development with ...
[More]
Background
There are numerous ways to consume REST API in C#. Starting with HttpClient, WebClient, HTTPWebRequest and Third-Party API. On this post, I will show you how to consume REST API in an easy way with C#.
Requirements
For this lab we use:
Visual Studio 2019 – http://visualstudio.com
Newton soft JSON - https://www.newtonsoft.com/json/
Rest sharp - http://restsharp.org/
Horosc...
[More]