Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'m trying to write a unit test in C#.NET in the class below im formatting a me

ID: 3856400 • Letter: I

Question

I'm trying to write a unit test in C#.NET in the class below im formatting a message and im printing this message as showed below. im grouping the items in {} as shown. this class will get a message that has the {} attributes but in this class im inheriting from Comman class where im formatting the message the way I have showen below. Can you write a unit test that will test if I the message formatted in CopyDocumentHistory class will match the unit test format. kinda like Assert.AreEqual()?

namespace Historian.Commands {

public class CopyDocumentHistory : Command { //Command is an abstract class contains properties: ClientUserName, ClientAppId, SourceLoanNumber, DetinationLoanNumber

public override string FormattedText() { //method to format a message returning a string

return $"Copied by {ClientUserName} using application {ClientAppId} from loan {SourceLoanNumber} to loan {DestinationLoanNumber}"; //the formatted message

}

}

}

Explanation / Answer

namespace Historian.Commands {

public class CopyDocumentHistory : Command { //Command is an abstract class contains properties: ClientUserName, ClientAppId, SourceLoanNumber, DetinationLoanNumber

public override string FormattedText() { //method to format a message returning a string

return $"Copied by {ClientUserName} using application {ClientAppId} from loan {SourceLoanNumber} to loan {DestinationLoanNumber}"; //the formatted message

}

}

}