예제 #1
0
        public bool Contains(long item)
        {
            StoreSession storeSession = this.session;
            bool         flag         = false;

            byte[] x;
            try
            {
                if (storeSession != null)
                {
                    storeSession.BeginMapiCall();
                    storeSession.BeginServerHealthCall();
                    flag = true;
                }
                if (StorageGlobals.MapiTestHookBeforeCall != null)
                {
                    StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                }
                x = this.session.Mailbox.MapiStore.GlobalIdFromId(item);
            }
            catch (MapiPermanentException ex)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.RuleHistoryError, ex, storeSession, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("RuleHistory.Contains. item = {0}.", item),
                    ex
                });
            }
            catch (MapiRetryableException ex2)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.RuleHistoryError, ex2, storeSession, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("RuleHistory.Contains. item = {0}.", item),
                    ex2
                });
            }
            finally
            {
                try
                {
                    if (storeSession != null)
                    {
                        storeSession.EndMapiCall();
                        if (flag)
                        {
                            storeSession.EndServerHealthCall();
                        }
                    }
                }
                finally
                {
                    if (StorageGlobals.MapiTestHookAfterCall != null)
                    {
                        StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                    }
                }
            }
            ArrayComparer <byte> comparer = ArrayComparer <byte> .Comparer;

            foreach (byte[] y in this.gids)
            {
                if (comparer.Equals(x, y))
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #2
0
        public void Equals_True_For_Identical()
        {
            ArrayComparer <Suggestion, SuggestionComparer> comparer = new ArrayComparer <Suggestion, SuggestionComparer>();

            Assert.True(comparer.Equals(baseline, matching));
        }
예제 #3
0
        public void Equals_False_For_Mismatches(Suggestion[] data)
        {
            ArrayComparer <Suggestion, SuggestionComparer> comparer = new ArrayComparer <Suggestion, SuggestionComparer>();

            Assert.False(comparer.Equals(baseline, data));
        }
예제 #4
0
        private bool BinaryEquals(byte[] bytes)
        {
            ArrayComparer <byte> comparer = ArrayComparer <byte> .Comparer;

            return(comparer.Equals(this.binaryData, bytes));
        }