0
Ich habe das Nur-Lese-String in einer Klasse:C# String-Interpolation Pass Wert in
public static class XssProtectionConstants {
/// <summary>
/// {0} specifies the report url, including protocol
/// </summary>
public static readonly string Report = "1; report={0}";
}
Ich mag darauf zugreifen und in einem Wert übergeben, so dass es jetzt gleich "1; report=www.reportMyErrors.com"
Es ist für diese Einheit Test Behauptung:
Assert.AreEqual(_policyValue, XssProtectionConstants.Report);
dies wirft:
Expected:<1; report=www.reportMyErrors.com>. Actual:<1; report={0}>. www.reportMyErrors.com
Wie kann ich meine Assertion aktualisieren, damit sie gleich "1; report=www.reportMyErrors.com>"
ist?
Verwenden Sie string.Format. Wie lautet der Code zum Ändern der Zeichenfolge? Du hängst es einfach an. –