Esempio n. 1
0
 public static void VerifySaveChanges(DataServiceResponseWrapper response)
 {
     Exception failure = FindChangesetFailures(response);
     if (failure != null)
         throw failure;
 }
Esempio n. 2
0
        public static Exception FindChangesetFailures(DataServiceResponseWrapper response)
        {
            Exception failure = null;
            foreach (ChangesetResponseWrapper changeset in response)
            {
                if (changeset.Error != null)
                    failure = changeset.Error;

                if (changeset.Descriptor.GetType() == typeof(EntityDescriptorWrapper))
                {
                    EntityDescriptorWrapper entity = (EntityDescriptorWrapper)changeset.Descriptor;
                    if (failure == null)
                        AstoriaTestLog.IsTrue(entity.State == EntityStates.Unchanged || entity.State == EntityStates.Detached);
                }
                else
                {
                    LinkDescriptorWrapper link = (LinkDescriptorWrapper)changeset.Descriptor;
                    if (failure == null)
                        AstoriaTestLog.IsTrue(link.State == EntityStates.Unchanged || link.State == EntityStates.Detached);
                }
            }

            return failure;
        }