Пример #1
0
        public static void SerializeDeserialize_NonGenericCollectionObjectWithoutTypeInformation_ThrowsException()
        {
            ICollectionObject ico = CreateICollectionObjectIList();

            Assert.Throws <InvalidOperationException>(() => SerializeDeserializeObject_Equal_Success(ico, XmlConvertOptions.ExcludeTypes)); //A non-generic IList without type annotations (can't be resolved)

            ico = CreateICollectionObjectIDictionary();
            Assert.Throws <InvalidOperationException>(() => SerializeDeserializeObject_Equal_Success(ico, XmlConvertOptions.ExcludeTypes)); //A non-generic IDictionary without type annotations (can't be resolved)
        }
Пример #2
0
        public override bool Equals(object obj)
        {
            ICollectionObject ico = (ICollectionObject)obj;

            if (ico == null)
            {
                return(false);
            }

            if (IListValue == null && ico.IListValue == null &&
                IDictionaryValue == null && ico.IDictionaryValue == null)
            {
                return(true);
            }

            return(IListValue != null && IListValue.Count.Equals(ico.IListValue.Count) &&
                   IDictionaryValue != null && IDictionaryValue.Count.Equals(ico.IDictionaryValue.Count));
        }
Пример #3
0
        public static void SerializeDeserialize_NonGenericCollectionObjectWithTypeInformation_Success()
        {
            ICollectionObject ico = CreateICollectionObjectFull();

            SerializeDeserializeObject_Equal_Success(ico, XmlConvertOptions.None);
        }