我在类中有这个只读字符串:
public static class XssProtectionConstants { ////// {0} specifies the report url, including protocol /// public static readonly string Report = "1; report={0}"; }
我想访问它并传入一个值,使它现在等于 "1; report=www.reportMyErrors.com"
这是为了这个单元测试断言:
Assert.AreEqual(_policyValue, XssProtectionConstants.Report );
这个抛出:
Expected:<1; report=www.reportMyErrors.com>. Actual:<1; report={0}>. www.reportMyErrors.com
如何更新我的断言以使其平等"1; report=www.reportMyErrors.com>"
?
Assert.AreEqual(_policyValue, string.Format(XssProtectionConstants.Report,"www.reportMyErrors.com" ) );