Month: September 2021
-
Unit testing C# with MSTest and .NET Core
Create the source project Create the test project Create a test Update the method
-
Unit testing C# with MSTest and .NET Core Part 1 – Create the source project
Writing Unit Tests is fun! So let’s follow this and write Unit Testing with MSTest. First create the folder structure for the project and inside create the solution file for the class library and the test project. Create a the new source project which is a class library and rename the Class1.cs to PrimeService.cs Go […]
-
Define a class in C# and create two instances of the class Part 3 – Create two instances from the class
Finally let’s create two instances from the class. Inside our TestPerson class and inside the Main method instantiate the instances by using the new keyword and call the constructor you wrote with the name paramater Now it’s time to return the instances value name property to the console. And here is the complete code. Time […]
-
Define a class in C# and create an instance of the class Part 2 – Create a new class
Write click on the solution and create a new class and name the class file Set the access modifier to public. Create an auto-implemented read only property. Next add a constructor that takes one argument. Now in the next post we’ll instantiate two instances of our Person class.
-
Define a class in C# and create an instance of the class Part 1 – Create a new console app and rename the existing class
Let’s follow the Microsoft C# programming guide here. First off create a new .Net console application. Next go ahead and right click and rename the Program class to This also renames the class to TestPerson. Now in the next post we’ll create the new class!
-
Define a class in C# and create two instances of the class
Create a new console app and rename the existing class Create a new class Create two instances from the class