public static bool AreEqual(object t1, object t2, CompareContext context) { var localContext = new CompareContext(context); // Check if either t1 or t2 are null or references of each other to see if we can terminate early. if (!ContinueCheckingEquality(t1, t2, localContext)) { return(context.Merge(localContext)); } string inter; // Use a special function for comparison if required by the specific class of the object. if (_equalityDict.TryGetValue(t1.GetType().ToString(), out Func <Object, object, CompareContext, bool> areEqual)) { areEqual(t1, t2, localContext); } // Check if any of the interfaces that the class uses require a special function. else if ((inter = t1.GetType().GetInterfaces().Select(t => t.ToString()).Intersect(_equalityDict.Keys).FirstOrDefault()) != null) { _equalityDict[inter](t1, t2, localContext); } return(context.Merge(localContext)); }
public static bool AreObjectDictionariesEqual(Object object1, Object object2, CompareContext context) { IDictionary <string, object> dictionary1 = (IDictionary <string, object>)object1; IDictionary <string, object> dictionary2 = (IDictionary <string, object>)object2; var localContext = new CompareContext(context); if (!ContinueCheckingEquality(dictionary1, dictionary2, localContext)) { return(context.Merge(localContext)); } if (dictionary1.Count != dictionary2.Count) { localContext.Diffs.Add($"(dictionary1.Count != dictionary2.Count: {dictionary1.Count}, {dictionary2.Count})"); } int numMatched = 0; foreach (string key in dictionary1.Keys) { if (dictionary2.ContainsKey(key)) { if (dictionary1[key].GetType() != dictionary2[key].GetType()) { localContext.Diffs.Add($"dictionary1[{key}].GetType() != dictionary2[{key}].GetType(). '{dictionary1[key].GetType()}' : '{dictionary2[key].GetType()}'"); continue; } var obj1 = dictionary1[key]; var obj2 = dictionary2[key]; if (obj1.GetType().BaseType == typeof(System.ValueType)) { if (!obj1.Equals(obj2)) { localContext.Diffs.Add(BuildStringDiff(key, obj1, obj2)); } } else { if (AreEqual(obj1, obj2, context)) { numMatched++; } } } else { localContext.Diffs.Add("dictionary1[key] ! found in dictionary2. key: " + key); } } return(context.Merge(localContext)); }
public static bool AreJwtSecurityTokensEqual(JwtSecurityToken jwt1, JwtSecurityToken jwt2, CompareContext context) { var localContext = new CompareContext(context); if (!ContinueCheckingEquality(jwt1, jwt2, localContext)) { return(context.Merge(localContext)); } CompareAllPublicProperties(jwt1, jwt2, localContext); return(context.Merge(localContext)); }
public static bool AreClaimsPrincipalsEqual(ClaimsPrincipal principal1, ClaimsPrincipal principal2, CompareContext context) { var localContext = new CompareContext(context); if (!ContinueCheckingEquality(principal1, principal2, localContext)) { return(context.Merge(localContext)); } CompareAllPublicProperties(principal1, principal2, localContext); return(context.Merge(localContext)); }
public static bool AreClaimsIdentitiesEqual(ClaimsIdentity identity1, ClaimsIdentity identity2, CompareContext context) { var localContext = new CompareContext(context); if (!ContinueCheckingEquality(identity1, identity2, localContext)) { return(context.Merge(localContext)); } CompareAllPublicProperties(identity1, identity2, localContext); return(context.Merge(localContext)); }
private static bool AreObjectsEqual(object object1, object object2, CompareContext context) { var localContext = new CompareContext(context); if (!ContinueCheckingEquality(object1, object2, localContext)) { return(context.Merge(localContext)); } AreEqual(object1, object2, localContext); return(context.Merge(localContext)); }
public static bool AreJArraysEqual(Object object1, Object object2, CompareContext context) { var a1 = (JArray)object1; var a2 = (JArray)object2; var localContext = new CompareContext(context); if (!ContinueCheckingEquality(a1, a2, localContext)) { return(context.Merge(localContext)); } if (a1.Count != a2.Count) { localContext.Diffs.Add("Count:"); localContext.Diffs.Add($"a1.Count != a2.Count. '{a1.Count}' : '{a2.Count}'"); } return(context.Merge(localContext)); }
public static bool AreKeyInfosEqual(KeyInfo keyInfo1, KeyInfo keyInfo2, CompareContext context) { var localContext = new CompareContext(context); if (ContinueCheckingEquality(keyInfo1, keyInfo2, context)) { CompareAllPublicProperties(keyInfo1, keyInfo2, localContext); } return(context.Merge(localContext)); }
public static bool AreSignedInfosEqual(SignedInfo signedInfo1, SignedInfo signedInfo2, CompareContext context) { var localContext = new CompareContext(context); if (ContinueCheckingEquality(signedInfo1, signedInfo2, localContext)) { CompareAllPublicProperties(signedInfo1, signedInfo2, localContext); } return(context.Merge(localContext)); }
public static bool AreWsFederationConfigurationsEqual(WsFederationConfiguration configuration1, WsFederationConfiguration configuration2, CompareContext context) { var localContext = new CompareContext(context); if (ContinueCheckingEquality(configuration1, configuration2, localContext)) { CompareAllPublicProperties(configuration1, configuration2, localContext); } return(context.Merge(localContext)); }
public static bool AreWsFederationMessagesEqual(WsFederationMessage message1, WsFederationMessage message2, CompareContext context) { var localContext = new CompareContext(context); if (ContinueCheckingEquality(message1, message2, localContext)) { CompareAllPublicProperties(message1, message2, localContext); } return(context.Merge(localContext)); }
public static bool AreUrisEqual(object object1, object object2, CompareContext context) { Uri uri1 = (Uri)object1; Uri uri2 = (Uri)object2; var localContext = new CompareContext(context); if (!ContinueCheckingEquality(uri1, uri2, localContext)) { return(context.Merge(localContext)); } if (!string.Equals(uri1.OriginalString, uri2.OriginalString, context.StringComparison)) { localContext.Diffs.Add($"'{uri1.OriginalString}'"); localContext.Diffs.Add($"!="); localContext.Diffs.Add($"'{uri2.OriginalString}'"); localContext.Diffs.Add($"'{context.StringComparison}'"); } return(context.Merge(localContext)); }
public static bool AreStringsEqual(object object1, object object2, CompareContext context) { string str1 = (string)object1; string str2 = (string)object2; var localContext = new CompareContext(context); if (!ContinueCheckingEquality(str1, str2, localContext)) { return(context.Merge(localContext)); } if (string.IsNullOrEmpty(str1) && string.IsNullOrEmpty(str2)) { return(true); } if (ReferenceEquals(str1, str2)) { return(true); } if (str1 == null || str2 == null) { localContext.Diffs.Add("(str1 == null || str2 == null)"); } if (!string.Equals(str1, str2, context.StringComparison)) { localContext.Diffs.Add($"'{str1}'"); localContext.Diffs.Add($"!="); localContext.Diffs.Add($"'{str2}'"); localContext.Diffs.Add($"'{context.StringComparison}'"); } return(context.Merge(localContext)); }
public static bool AreSecurityKeysEqual(SecurityKey securityKey1, SecurityKey securityKey2, CompareContext context) { var localContext = new CompareContext(context); if (!ContinueCheckingEquality(securityKey1, securityKey2, localContext)) { return(context.Merge(localContext)); } // X509SecurityKey doesn't have to use reflection to get cert. X509SecurityKey x509Key1 = securityKey1 as X509SecurityKey; X509SecurityKey x509Key2 = securityKey2 as X509SecurityKey; if (x509Key1 != null && x509Key2 != null) { CompareAllPublicProperties(x509Key1, x509Key2, localContext); } SymmetricSecurityKey symKey1 = securityKey1 as SymmetricSecurityKey; SymmetricSecurityKey symKey2 = securityKey2 as SymmetricSecurityKey; if (symKey1 != null && symKey2 != null) { CompareAllPublicProperties(symKey1, symKey2, localContext); } RsaSecurityKey rsaKey1 = securityKey1 as RsaSecurityKey; RsaSecurityKey rsaKey2 = securityKey2 as RsaSecurityKey; if (rsaKey1 != null && rsaKey2 != null) { CompareAllPublicProperties(rsaKey1, rsaKey2, localContext); } return(context.Merge(localContext)); }
public static bool AreStringDictionariesEqual(Object object1, Object object2, CompareContext context) { IDictionary <string, string> dictionary1 = (IDictionary <string, string>)object1; IDictionary <string, string> dictionary2 = (IDictionary <string, string>)object2; var localContext = new CompareContext(context); if (!ContinueCheckingEquality(dictionary1, dictionary2, localContext)) { return(context.Merge(localContext)); } if (dictionary1.Count != dictionary2.Count) { localContext.Diffs.Add($"(dictionary1.Count != dictionary2.Count: {dictionary1.Count}, {dictionary2.Count})"); } int numMatched = 0; foreach (string key in dictionary1.Keys) { if (dictionary2.ContainsKey(key)) { if (!dictionary1[key].Equals(dictionary2[key])) { localContext.Diffs.Add($"dictionary1[key] != dictionary2[key], key: '{key}' value1, value2: '{dictionary1[key]}' + '{dictionary2[key]}'"); } else { numMatched++; } } else { localContext.Diffs.Add("dictionary1[key] ! found in dictionary2. key: " + key); } } context.Diffs.AddRange(localContext.Diffs); return(localContext.Diffs.Count == 0); }
public static bool AreBytesEqual(object object1, object object2, CompareContext context) { var bytes1 = (byte[])object1; var bytes2 = (byte[])object2; var localContext = new CompareContext(context); if (bytes1 == null && bytes2 == null) { return(true); } if (bytes1 == null || bytes2 == null) { localContext.Diffs.Add("(bytes1 == null || bytes2 == null)"); } if (bytes1.Length != bytes2.Length) { localContext.Diffs.Add("(bytes1.Length != bytes2.Length)"); } else { for (int i = 0; i < bytes1.Length; i++) { if (bytes1[i] != bytes2[i]) { localContext.Diffs.Add($"'{bytes1}'"); localContext.Diffs.Add("!="); localContext.Diffs.Add($"'{bytes2}'"); } } } return(context.Merge(localContext)); }
public static bool AreX509Certificate2Equal(object object1, object object2, CompareContext context) { var certificate1 = (X509Certificate2)object1; var certificate2 = (X509Certificate2)object2; var localContext = new CompareContext(context); if (certificate1 == null && certificate2 == null) { return(true); } if (certificate1 == null || certificate2 == null || !certificate1.Equals(certificate2)) { localContext.Diffs.Add("X509Certificate2:"); if (certificate1 == null) { localContext.Diffs.Add($"certificate: null"); } else { localContext.Diffs.Add($"certificate: {certificate1}"); } localContext.Diffs.Add("!="); if (certificate2 == null) { localContext.Diffs.Add($"certificate: null"); } else { localContext.Diffs.Add($"certificate: {certificate2}"); } } return(context.Merge(localContext)); }
public static bool CompareAllPublicProperties(object obj1, object obj2, CompareContext context) { Type type = obj1.GetType(); var localContext = new CompareContext(context); // public instance properties var propertyInfos = type.GetProperties(BindingFlags.Public | BindingFlags.Instance); // Touch each public property foreach (var propertyInfo in propertyInfos) { bool skipProperty = false; if (context.PropertiesToIgnoreWhenComparing != null && context.PropertiesToIgnoreWhenComparing.TryGetValue(type, out List <string> propertiesToIgnore)) { foreach (var val in propertiesToIgnore) { if (string.Equals(val, propertyInfo.Name, StringComparison.OrdinalIgnoreCase)) { skipProperty = true; break; } } } if (skipProperty) { continue; } var propertyContext = new CompareContext(context); try { if (type == typeof(Claim)) { if (context.IgnoreSubject && propertyInfo.Name == "Subject") { continue; } if (context.IgnoreProperties && propertyInfo.Name == "Properties") { continue; } } if (propertyInfo.GetMethod != null) { object val1 = propertyInfo.GetValue(obj1, null); object val2 = propertyInfo.GetValue(obj2, null); if ((val1 == null) && (val2 == null)) { continue; } if ((val1 == null) || (val2 == null)) { localContext.Diffs.Add($"{propertyInfo.Name}:"); localContext.Diffs.Add(BuildStringDiff(propertyInfo.Name, val1, val2)); } #if CrossVersionTokenValidation else if (type == typeof(ClaimsIdentity) && String.Equals(propertyInfo.Name, "AuthenticationType", StringComparison.Ordinal) && String.Equals(Convert.ToString(val1), AuthenticationTypes.Federation, StringComparison.Ordinal) && String.Equals(Convert.ToString(val2), "AuthenticationTypes.Federation", StringComparison.Ordinal)) { continue; } else if (type == typeof(Claim) && String.Equals(propertyInfo.Name, "Value", StringComparison.Ordinal) && (String.Equals((val1 as string), "urn:oasis:names:tc:SAML:1.0:am:password", StringComparison.Ordinal) || String.Equals((val2 as string), "urn:oasis:names:tc:SAML:1.0:am:password", StringComparison.Ordinal))) { continue; } else if (type == typeof(ClaimsPrincipal) && String.Equals(propertyInfo.Name, "Claims", StringComparison.Ordinal) && (val1 as IEnumerable <Claim>).Count() == 0) { continue; } else if (type == typeof(ClaimsIdentity) && String.Equals(propertyInfo.Name, "Claims", StringComparison.Ordinal) && (val1 as IEnumerable <Claim>).Count() == 0) { continue; } #endif else if (val1.GetType().BaseType == typeof(System.ValueType) && !_equalityDict.Keys.Contains(val1.GetType().ToString())) { if (!val1.Equals(val2)) { localContext.Diffs.Add($"{propertyInfo.Name}:"); localContext.Diffs.Add(BuildStringDiff(propertyInfo.Name, val1, val2)); } } else { AreEqual(val1, val2, propertyContext); localContext.Merge($"{propertyInfo.Name}:", propertyContext); } } } catch (Exception ex) { localContext.Diffs.Add($"Reflection failed getting 'PropertyInfo: {propertyInfo.Name}'. Exception: '{ex}'."); } } return(context.Merge($"CompareAllPublicProperties: {type}", localContext)); }
public static bool AreClaimsEnumsEqual(object object1, object object2, CompareContext context) { IEnumerable <Claim> t1 = (IEnumerable <Claim>)object1; IEnumerable <Claim> t2 = (IEnumerable <Claim>)object2; var claims1 = new List <Claim>(t1); var claims2 = new List <Claim>(t2); if (claims1.Count != claims2.Count) { context.Diffs.Add($"claims1.Count != claims2.Count: {claims1.Count}, {claims2.Count}"); context.Diffs.Add("claims1:"); foreach (var claim in claims1) { context.Diffs.Add(claim.Type + ": " + claim.Value + ": " + claim.ValueType + ": " + claim.Issuer + ": " + claim.OriginalIssuer); } context.Diffs.Add("claims2:"); foreach (var claim in claims2) { context.Diffs.Add(claim.Type + ": " + claim.Value + ": " + claim.ValueType + ": " + claim.Issuer + ": " + claim.OriginalIssuer); } } int numMatched = 0; int numToMatch = claims1.Count; var localContext = new CompareContext(context); var matchedClaims = new List <Claim>(); var notMatched = new List <Claim>(); foreach (var t in t1) { var perClaimContext = new CompareContext(localContext); bool matched = false; for (int i = 0; i < claims2.Count; i++) { if (AreClaimsEqual(t, claims2[i], perClaimContext)) { numMatched++; matchedClaims.Add(t); matched = true; claims2.RemoveAt(i); break; } } if (!matched) { notMatched.Add(t); } } if (numMatched != numToMatch) { localContext.Diffs.Add(Environment.NewLine + "numMatched != numToMatch: " + numMatched + ", " + numToMatch); localContext.Diffs.Add(Environment.NewLine + "Claims1 NOT Matched:" + Environment.NewLine); foreach (var claim in notMatched) { localContext.Diffs.Add(claim.Type + ": " + claim.Value + ": " + claim.ValueType + ": " + claim.Issuer + ": " + claim.OriginalIssuer); } localContext.Diffs.Add(Environment.NewLine + "Claims2 NOT Matched:" + Environment.NewLine); foreach (var claim in claims2) { localContext.Diffs.Add(claim.Type + ": " + claim.Value + ": " + claim.ValueType + ": " + claim.Issuer + ": " + claim.OriginalIssuer); } localContext.Diffs.Add(Environment.NewLine + "Claims Matched:" + Environment.NewLine); foreach (var claim in matchedClaims) { localContext.Diffs.Add(claim.Type + ": " + claim.Value + ": " + claim.ValueType + ": " + claim.Issuer + ": " + claim.OriginalIssuer); } localContext.Diffs.Add(Environment.NewLine); } return(context.Merge(localContext)); }
public static bool AreEnumsEqual <T>(IEnumerable <T> t1, IEnumerable <T> t2, CompareContext context, Func <T, T, CompareContext, bool> areEqual) { List <T> toMatch = new List <T>(t1); List <T> expectedValues = new List <T>(t2); if (toMatch.Count != expectedValues.Count) { context.Diffs.Add("toMatch.Count != expectedToMatch.Count: " + toMatch.Count + ", " + expectedValues.Count + ", typeof: " + t1.GetType().ToString()); return(false); } int numMatched = 0; int numToMatch = toMatch.Count; CompareContext localContext = new CompareContext(context); List <KeyValuePair <T, T> > matchedTs = new List <KeyValuePair <T, T> >(); // helps debugging to see what didn't match List <T> notMatched = new List <T>(); foreach (var t in t1) { var perItemContext = new CompareContext(localContext); bool matched = false; for (int i = 0; i < expectedValues.Count; i++) { if (areEqual(t, expectedValues[i], perItemContext)) { numMatched++; matchedTs.Add(new KeyValuePair <T, T>(expectedValues[i], t)); matched = true; expectedValues.RemoveAt(i); perItemContext.Diffs.Clear(); break; } perItemContext.Diffs.Add("===========================\n\r"); } if (!matched) { notMatched.Add(t); localContext.Diffs.AddRange(perItemContext.Diffs); } } if (numMatched != numToMatch) { localContext.Diffs.Add("numMatched != numToMatch: " + numMatched + ", " + numToMatch); if (notMatched.Count > 0) { localContext.Diffs.Add(Environment.NewLine + "items in first enumeration NOT Matched"); foreach (var item in notMatched) { if (item != null) { localContext.Diffs.Add(item.ToString()); } else { localContext.Diffs.Add("item is null"); } } } if (expectedValues.Count > 0) { localContext.Diffs.Add(Environment.NewLine + "expectedValues NOT Matched"); foreach (var item in expectedValues) { if (item != null) { localContext.Diffs.Add(item.ToString()); } else { localContext.Diffs.Add("item is null"); } } } if (matchedTs.Count > 0) { localContext.Diffs.Add(Environment.NewLine + "items that were Matched"); foreach (var item in matchedTs) { localContext.Diffs.Add(item.Key.ToString()); } } } return(context.Merge(localContext)); }
public static bool AreClaimsIdentitiesEnumsEqual(Object object1, Object object2, CompareContext context) { IEnumerable <ClaimsIdentity> t1 = (IEnumerable <ClaimsIdentity>)object1; IEnumerable <ClaimsIdentity> t2 = (IEnumerable <ClaimsIdentity>)object2; if (t1 == null && t2 == null) { return(true); } if (t1 == null) { context.Diffs.Add("t1 == null, t2 != null"); return(false); } if (t2 == null) { context.Diffs.Add("t1 != null, t2 == null"); return(false); } if (ReferenceEquals(t1, t2)) { return(true); } var claimsIdentity1 = new List <ClaimsIdentity>(t1); var claimsIdentity2 = new List <ClaimsIdentity>(t2); if (claimsIdentity1.Count != claimsIdentity2.Count) { context.Diffs.Add($"claimsIdentity1.Count != claimsIdentity2.Count: {claimsIdentity1.Count}, {claimsIdentity2.Count}"); context.Diffs.Add("claimsIdentity1:"); foreach (var identity in claimsIdentity1) { context.Diffs.Add(identity.Name + ": " + identity.Label + ": " + identity.IsAuthenticated + ": " + identity.AuthenticationType + ": " + identity.RoleClaimType + ": " + identity.NameClaimType); } context.Diffs.Add("claimsIdentity2:"); foreach (var identity in claimsIdentity2) { context.Diffs.Add(identity.Name + ": " + identity.Label + ": " + identity.IsAuthenticated + ": " + identity.AuthenticationType + ": " + identity.RoleClaimType + ": " + identity.NameClaimType); } } int numMatched = 0; int numToMatch = claimsIdentity1.Count; var localContext = new CompareContext(context); var matchedClaimsIdentities = new List <ClaimsIdentity>(); var notMatched = new List <ClaimsIdentity>(); foreach (var t in t1) { var perClaimContext = new CompareContext(localContext); bool matched = false; for (int i = 0; i < claimsIdentity2.Count; i++) { if (AreClaimsIdentitiesEqual(t, claimsIdentity2[i], perClaimContext)) { numMatched++; matchedClaimsIdentities.Add(t); matched = true; claimsIdentity2.RemoveAt(i); break; } } if (!matched) { notMatched.Add(t); } } if (numMatched != numToMatch) { localContext.Diffs.Add(Environment.NewLine + "numMatched != numToMatch: " + numMatched + ", " + numToMatch); localContext.Diffs.Add(Environment.NewLine + "claimsIdentity1 NOT Matched:" + Environment.NewLine); foreach (var identity in notMatched) { localContext.Diffs.Add(identity.Name + ": " + identity.Label + ": " + identity.IsAuthenticated + ": " + identity.AuthenticationType + ": " + identity.RoleClaimType + ": " + identity.NameClaimType); } localContext.Diffs.Add(Environment.NewLine + "claimsIdentity2 NOT Matched:" + Environment.NewLine); foreach (var identity in claimsIdentity2) { localContext.Diffs.Add(identity.Name + ": " + identity.Label + ": " + identity.IsAuthenticated + ": " + identity.AuthenticationType + ": " + identity.RoleClaimType + ": " + identity.NameClaimType); } localContext.Diffs.Add(Environment.NewLine + "claimsIdentity Matched:" + Environment.NewLine); foreach (var identity in matchedClaimsIdentities) { localContext.Diffs.Add(identity.Name + ": " + identity.Label + ": " + identity.IsAuthenticated + ": " + identity.AuthenticationType + ": " + identity.RoleClaimType + ": " + identity.NameClaimType); } localContext.Diffs.Add(Environment.NewLine); } return(context.Merge(localContext)); }
public static bool AreRsaParametersEqual(object object1, object object2, CompareContext context) { RSAParameters rsaParameters1 = (RSAParameters)object1; RSAParameters rsaParameters2 = (RSAParameters)object2; var localContext = new CompareContext(context); if (!ContinueCheckingEquality(rsaParameters1, rsaParameters2, localContext)) { return(context.Merge(localContext)); } if (!AreBytesEqual(rsaParameters1.D, rsaParameters2.D, context)) { localContext.Diffs.Add("D:"); localContext.Diffs.Add("!AreBytesEqual(rsaParameters1.D, rsaParameters2.D)"); } if (!AreBytesEqual(rsaParameters1.DP, rsaParameters2.DP, context)) { localContext.Diffs.Add("DP:"); localContext.Diffs.Add("!AreBytesEqual(rsaParameters1.DP, rsaParameters2.DP)"); } if (!AreBytesEqual(rsaParameters1.DQ, rsaParameters2.DQ, context)) { localContext.Diffs.Add("DQ:"); localContext.Diffs.Add("!AreBytesEqual(rsaParameters1.DQ, rsaParameters2.DQ)"); } if (!AreBytesEqual(rsaParameters1.Exponent, rsaParameters2.Exponent, context)) { localContext.Diffs.Add("Exponent:"); localContext.Diffs.Add("!AreBytesEqual(rsaParameters1.Exponent, rsaParameters2.Exponent)"); } if (!AreBytesEqual(rsaParameters1.InverseQ, rsaParameters2.InverseQ, context)) { localContext.Diffs.Add("InverseQ:"); localContext.Diffs.Add("!AreBytesEqual(rsaParameters1.InverseQ, rsaParameters2.InverseQ)"); } if (!AreBytesEqual(rsaParameters1.Modulus, rsaParameters2.Modulus, context)) { localContext.Diffs.Add("Modulus:"); localContext.Diffs.Add("!AreBytesEqual(rsaParameters1.Modulus, rsaParameters2.Modulus)"); } if (!AreBytesEqual(rsaParameters1.P, rsaParameters2.P, context)) { localContext.Diffs.Add("P:"); localContext.Diffs.Add("!AreBytesEqual(rsaParameters1.P, rsaParameters2.P)"); } if (!AreBytesEqual(rsaParameters1.Q, rsaParameters2.Q, context)) { localContext.Diffs.Add("Q:"); localContext.Diffs.Add("!AreBytesEqual(rsaParameters1.Q, rsaParameters2.Q)"); } return(context.Merge(localContext)); }