# MS Unit testing (C# .net)

**URL:** <https://forum.codewithmosh.com/t/ms-unit-testing-c-net/2975>\
**Category:** C#\
**Created:** [February 24, 2021, 11:24am UTC](https://forum.codewithmosh.com/t/ms-unit-testing-c-net/2975 "2021-02-24T11:24:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Irfoo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/irfoo/32/1018_2.png) [@Irfoo](https://forum.codewithmosh.com/u/Irfoo)\
**Post date:** [February 24, 2021, 11:24am UTC](https://forum.codewithmosh.com/t/ms-unit-testing-c-net/2975/1 "2021-02-24T11:24:35Z")

</div>

Hi Everyone,  
Hope you all are doing well!  
I need some help in MS-Unit testing in C# .net program, I watched all of your youtube videos but…  
So,  
Below is my question, Please help!  
Write Automated MS-Unit Test in C#.NET for the following C#.NET program. The program converts a decimal value into binary? (10 Marks)

using System;  
namespace BinaryClass  
{  
class Program  
{  
static void Main(string[] args)  
{  
Program p = new Program();  
Console.WriteLine("Binary Value of 4 = "+p.IntToBinaryString(4));  
}  
public string IntToBinaryString(int number)  
{  
const int mask = 1;  
var binary = string.Empty;  
while (number \> 0)  
{  
binary = (number & mask) + binary;  
number = number \>\> 1;  
}  
return binary;  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![armen23](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@armen23](https://forum.codewithmosh.com/u/armen23)\
**Post date:** [December 23, 2021, 11:37am UTC](https://forum.codewithmosh.com/t/ms-unit-testing-c-net/2975/2 "2021-12-23T11:37:38Z")

</div>

With the appearance of programming languages like Python, Ruby on Rails, etc., there’s questioning among the developer network that the C language is dropping relevance. Strikingly, C continues to be taken into consideration as a dominant programming language for device programming because it affords optimized system commands for any form of furnished input. Not handiest C, the languages which are\*

- derived from C, i.e., C# and C++, also are embraced with palms extensive open with the aid of using the developer network. As a long way as unit checking out /automation checking out the usage of C# is concerned, there are a few frameworks like NUnit, [xUnit.Net](http://xUnit.Net), MSTest Framework, etc., to shop the day. The MSTest framework affords the essential gear to verify & validate your supply code. The framework acknowledges exams through the one-of-a-kind attributes/annotations beneath neath which the check code is present. Some of the famous attributes are [TestInitialize], [TestMethod], [TestCleanup], etc. We may have an in-depth examine every one of those attributes in addition to sections of this  
For More Information: [https://www.easyfie.com/read-blog/734214](https://www.easyfie.com/read-blog/734214)
