public override string GenerateErrorMessage(TestEnvironment environment) { const string format = @" Dictionary ""{0}"" should not contain key ""{1}"" with value ""{2}"" {3}"; var codePart = environment.GetCodePart(); var expectedValue = environment.Expected.Inspect(); var actualValue = environment.Actual.Inspect(); var keyValue = environment.Key.Inspect(); if (environment.HasKey) { var valueString = "but does"; return String.Format(format, codePart, keyValue.Trim('"'), expectedValue.Trim('"'), valueString); } else { return String.Format(format, codePart, actualValue.Trim('"'), expectedValue.Trim('"'), "but the key does not exist"); } }
public override string GenerateErrorMessage(TestEnvironment environment) { const string format = @" {0} {1}"; var codePart = environment.GetCodePart(); var expectedValue = environment.Expected.Inspect(); if (environment.IsNegatedAssertion) return String.Format(format, codePart, environment.ShouldMethod.PascalToSpaced(), environment.Expected == null ? "null" : ""); return String.Format(format, codePart, environment.ShouldMethod.PascalToSpaced(), expectedValue); }
public override string GenerateErrorMessage(TestEnvironment environment) { const string format = @" Dictionary ""{0}"" {1} ""{2}"" but does {3}"; var codePart = environment.GetCodePart(); var expectedValue = environment.Expected.Inspect(); if (environment.IsNegatedAssertion) return String.Format(format, codePart, environment.ShouldMethod.PascalToSpaced(), environment.Expected, ""); return String.Format(format, codePart, environment.ShouldMethod.PascalToSpaced(), expectedValue.Trim('"'), "not"); }