Click here to Skip to main content
15,887,683 members

Comments by Virendra S from Bangalore, Karnataka (Top 42 by date)

Virendra S from Bangalore, Karnataka 28-Mar-23 22:31pm View    
you gave the entire requirement here.
suggestion: break the requirements into smaller pieces. start coding.
Yes, it is saying that always the condition is not tested. already wrote few tests cases to cover this scenario.

[Fact]
public void Equals_WithNull_ShouldReturnFalse()
{
// Arrange
var headers = new BaseHeaderRequest();

// Act
var result = headers.Equals(null);

// Assert
result.Should().BeFalse();
}



[Fact]
public void EqualsShouldReturnFalseWhenDifferentObjectComparedWithBaseHeaderRequestObject()
{
//Arrange
var someObj = new List<string>();
var objBaseHeaderRequest = new BaseHeaderRequest();

//Act
var result = objBaseHeaderRequest.Equals(someObj);

//Assert
result.Should().BeFalse();
}
For null case handled by below unit test.

[Fact]
public void Equals_WithNull_ShouldReturnFalse()
{
// Arrange
var headers = new BaseHeaderRequest();

// Act
var result = headers.Equals(null);

// Assert
result.Should().BeFalse();
}
I hope that is what I'm trying to do it, In case of C# we easily find it by looking at Using Namespace section. is there any similar things in C++?
Virendra S from Bangalore, Karnataka 29-Oct-22 16:29pm View    
Thanks Graeme_Grant