JSTest.NET from Nuget integration with MS Test Series Part 3

This is part 3 of 6 posts, you can find the previous post here.

Sample JavaScript test in .js file:

The Add function mentioned in the previous post can have a test code as mentioned below:

function returnSumOfTwoNumber() {
    //Arrange
    var expectedOutput = 3;
    var actualOutput = null;

    //Act
    actualOutput = Add(1,2);

    //Assert
    assertEqual(expectOutput, actualOutput);
}

The keyword here is assertEqual to match the expected output to actual output.

Other points will be explained in following post, read  Part 4 here.

Advertisement

2 comments

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: