Exemple #1
0
            // Adjust entry so that comparisons against the expected document type
            // don't fail if we expect 'none' and have 'proteomic' or vice versa
            // We do this in this rather complicated way since we don't want to add any special
            // to the equality members of LogMessage.
            private AuditLogEntry AdjustDocumentType(AuditLogEntry entry)
            {
                if (ExpectedUndoRedo.DocumentType != entry.UndoRedo.DocumentType)
                {
                    entry = entry.ChangeUndoRedo(
                        entry.UndoRedo.MessageInfo.ChangeDocumentType(GetNewDocType(ExpectedUndoRedo.DocumentType,
                                                                                    entry.UndoRedo.DocumentType)));
                }

                if (ExpectedSummary.DocumentType != entry.Summary.DocumentType)
                {
                    entry = entry.ChangeSummary(
                        entry.Summary.MessageInfo.ChangeDocumentType(GetNewDocType(ExpectedSummary.DocumentType,
                                                                                   entry.Summary.DocumentType)));
                }


                // We take care of the case where the length doesn't match later
                if (ExpectedAllInfo.Length == entry.AllInfo.Count)
                {
                    int index  = entry.InsertUndoRedoIntoAllInfo ? 1 : 0;
                    var actual = entry.AllInfo.Skip(index).ToArray();
                    for (var i = index; i < ExpectedAllInfo.Length; ++i)
                    {
                        if (ExpectedAllInfo[i].DocumentType != actual[i - index].DocumentType)
                        {
                            actual[i - index] = (DetailLogMessage)actual[i - index].ChangeDocumentType(GetNewDocType(ExpectedAllInfo[i].DocumentType,
                                                                                                                     actual[i - index].DocumentType));
                        }
                    }
                    entry = entry.ChangeAllInfo(actual);
                }

                return(entry);
            }