0

I have this read-only string in a class:

public static class XssProtectionConstants {
    /// <summary>
    /// {0} specifies the report url, including protocol
    /// </summary>
    public static readonly string Report = "1; report={0}";
}

I want to access it and pass in a value so that it now equals "1; report=www.reportMyErrors.com"

It is for this unit test assertion:

Assert.AreEqual(_policyValue, XssProtectionConstants.Report );

this throws:

Expected:<1; report=www.reportMyErrors.com>. Actual:<1; report={0}>. www.reportMyErrors.com

How can I update my assertion to make it equal "1; report=www.reportMyErrors.com>"?

1
  • Use string.Format. what is your code for changing your string? You're just appending it. Commented Jan 12, 2017 at 21:10

1 Answer 1

5
Assert.AreEqual(_policyValue, string.Format(XssProtectionConstants.Report,"www.reportMyErrors.com" ) );
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.