public void CompareReturnYesOrNo_WhenInputsEqual_returnsYes() { //Arrange _someFunctions.CompareTwoStrings(Arg.Any <string>(), Arg.Any <string>()).Returns(true); //Mocking dependency class to return true for any string inputs //Action var result = sut.CompareReturnYesOrNo("somestring", "somestring"); //inputs are useless as we are mocking the dependency method to return true //Assert Assert.NotNull(result); Assert.Equal("Yes", result); }
/// <summary> /// Check if two strings are equal or not by returning Yes or No /// </summary> /// <param name="a"></param> /// <param name="b"></param> /// <returns></returns> public string CompareReturnYesOrNo(string a, string b) { if (string.IsNullOrEmpty(a) || string.IsNullOrEmpty(b)) { return(null); } return(_someFunctions.CompareTwoStrings(a, b)? "Yes" : "No"); }