Posts

Showing posts with the label unit test case

Writing a unit test case for a simple class in Dynamics 365 for Finance and Operations

Image
This is to show how to write a unit test case in Dynamics 365 for Finance and Operations for a simple class. I have created a class to do simple arithmetic calculation called “ MyCalculator ” and created “ MyCalculatorUnitTest ” unit test class. In this test class shown three ways of adding the test methods. 1)        Adding  [ SysTestMethodAttribute ]   attribute   2)        Prefix the case with “test” in the method name 3)        Adding  [ SysTestMethod ,  SysTestGranularityAttribute ( SysTestGranularity ::Unit)] attribute . After creating test cases it can be viewed in Test Explorer (Test > Windows> Test Explorer) as shown below. Main Class: class   MyCalculator {      real     valueA,valueB;      public   void  setValueA( real  _a)     { ...