public override bool Equals(object obj) { InterfacePropertyType other = obj as InterfacePropertyType; if (other != null) { if (other.Id == this.Id) { if ((this.Lookup == null && other.Lookup == null) || (this.Lookup.Count == other.Lookup.Count && this.Lookup.SequenceEqual(other.Lookup)) ) { return(true); } } } return(false); }
public void InterfacePropertyTypeDeserialization() { List<Tuple<object, string>> testCases = new List<Tuple<object, string>>() { new Tuple<object, string>(new InterfacePropertyType() { Id = 5, Lookup = new Dictionary<string,string>() { { "x", "y"}} }, "{\"id\":5,\"Lookup\":{\"x\":\"y\"}}"), }; // Need to ensure that the type is registered as a table to force the id property check DefaultSerializer.SerializerSettings.ContractResolver.ResolveTableName(typeof(InterfacePropertyType)); foreach (var testCase in testCases) { var input = testCase.Item2; var expected = testCase.Item1; var actual = new InterfacePropertyType(); DefaultSerializer.Deserialize(input, actual); Assert.AreEqual(actual, expected); } }