public void A_dictionary_of_no_objects_should_be_properly_serialized() { var message = new DictionaryContainerClass { Elements = new Dictionary <string, OuterClass>() }; TestSerialization(message); }
public bool Equals(DictionaryContainerClass other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } if (ReferenceEquals(other.Elements, Elements)) { return(true); } if (other.Elements == null && Elements != null) { Trace.WriteLine("other element was null"); return(false); } if (other.Elements != null && Elements == null) { Trace.WriteLine("other element was not null"); return(false); } if (other.Elements != null && Elements != null) { if (other.Elements.Count != Elements.Count) { return(false); } foreach (var pair in Elements) { if (!other.Elements.ContainsKey(pair.Key)) { return(false); } if (!Equals(pair.Value, other.Elements[pair.Key])) { return(false); } } } return(true); }
public void A_dictionary_of_one_objects_should_be_properly_serialized() { var message = new DictionaryContainerClass { Elements = new Dictionary <string, OuterClass> { { "David", new OuterClass { Inner = new InnerClass { Name = "David" } } } } }; TestSerialization(message); }
public bool Equals(DictionaryContainerClass other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } if (ReferenceEquals(other.Elements, Elements)) { return(true); } if (other.Elements == null && Elements != null) { return(false); } if (other.Elements != null && Elements == null) { return(false); } if (other.Elements != null && Elements != null) { if (other.Elements.Count != Elements.Count) { return(false); } foreach (KeyValuePair <string, OuterClass> pair in Elements) { if (!other.Elements.ContainsKey(pair.Key)) { return(false); } if (!Equals(pair.Value, other.Elements[pair.Key])) { return(false); } } } return(true); }