Пример #1
0
        public void TrapOutsideFaultScope()
        {
            Exception e;
            object    o;

            Assert.False(FaultDispatcher.Trap(out e, out o));
        }
            public InnerClass()
            {
                Exception a;
                object    b;

                Assert.True(FaultDispatcher.Trap(out a, out b) == true);
            }
Пример #3
0
                public void DoublyNestedClassTest()
                {
                    Exception a;
                    object    b;

                    Assert.True(FaultDispatcher.Trap(out a, out b));
                }
Пример #4
0
        private bool TesteeTriggerOnNthCallBy()
        {
            Exception a;
            object    b;

            return(FaultDispatcher.Trap(out a, out b));
        }
Пример #5
0
        public void ThrowCustomExceptionTest()
        {
            Exception a;
            object    b;

            FaultDispatcher.Trap(out a, out b);
            Assert.IsType(typeof(CustomizedException), a);
        }
Пример #6
0
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045")] //ref obj parameter
        public void TestMethod(out Int32[][] intArray, ref object obj, TestEnum[,,] testEnum, NestedClass[][] nestedClass, params int[] intArray2)
        {
            intArray = null;
            Exception a;
            object    b;

            Assert.True(FaultDispatcher.Trap(out a, out b) == true);
        }
Пример #7
0
        public void ThrowBuiltInExceptionTest()
        {
            Exception a;
            object    b;

            FaultDispatcher.Trap(out a, out b);
            Assert.IsType(typeof(ApplicationException), a);
        }
Пример #8
0
        private void TargetMethodTwoGenericParams <T_first, T_second>(T_first t1, T_second t2)
        {
            Exception e;
            object    o;
            bool      ret = FaultDispatcher.Trap(out e, out o);

            AssertTrapSuccess(ret, e, o);
        }
Пример #9
0
            public void TargetMethod()
            {
                Exception e;
                object    o;
                bool      ret = FaultDispatcher.Trap(out e, out o);

                AssertTrapSuccess(ret, e, o);
            }
Пример #10
0
        private void TargetMethodJaggedArrayParam(int[][] i)
        {
            Exception e;
            object    o;
            bool      ret = FaultDispatcher.Trap(out e, out o);

            AssertTrapSuccess(ret, e, o);
        }
Пример #11
0
        private void TargetMethodOneGenericParam <T>(T t)
        {
            Exception e;
            object    o;
            bool      ret = FaultDispatcher.Trap(out e, out o);

            AssertTrapSuccess(ret, e, o);
        }
Пример #12
0
        private void TargetMethodNoParams()
        {
            Exception e;
            object    o;
            bool      ret = FaultDispatcher.Trap(out e, out o);

            AssertTrapSuccess(ret, e, o);
        }
Пример #13
0
        private void TargetMethodOutParam(out int i)
        {
            i = 0;
            Exception e;
            object    o;
            bool      ret = FaultDispatcher.Trap(out e, out o);

            AssertTrapSuccess(ret, e, o);
        }
Пример #14
0
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1720")] //Bool in name
        public bool ReturnBoolTargetMethod(string str, Int32 number)
        {
            Exception a;
            object    b;

            Assert.True(FaultDispatcher.Trap(out a, out b));
            Assert.Null(a);
            return((bool)b);
        }
Пример #15
0
 public TargetNestedClassGeneric(bool doTrap)
 {
     if (doTrap)
     {
         Exception e;
         object    o;
         bool      ret = FaultDispatcher.Trap(out e, out o);
         AssertTrapSuccess(ret, e, o);
     }
 }
Пример #16
0
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045")] //ref obj parameter
        public void TestMethod(out Int32[][] intArray, ref object obj, TestEnum[,,] testEnum, NestedClass[][] nestedClass, params int[] intArray2)
        {
            intArray = null;
            Exception a;
            object    b;

            // BUG: The code below used to Assert than FD.Trap returns true.
            // In the latest version of TestApi (which uses xUnit 1.5), this changed. We have
            // confirmed that the FI functionality works as expected, so we are capturing this fault
            //  as current expected behavior for AppCompat reasons.
            Assert.True(FaultDispatcher.Trap(out a, out b) == false);
        }
Пример #17
0
        public bool Update(IMongoQuery query, IMongoUpdate update, UpdateFlags flags)
        {
            Exception a;
            object    b;

            if (FaultDispatcher.Trap(out a, out b))
            {
                return(HandleFaultEvent <bool>(MongoRepositoryHelper.Method.UPDATE_CAS, a, b));
            }

            return(this.repository.Update(query, update, flags));
        }
Пример #18
0
        public T Single(Expression <Func <T, bool> > criteria)
        {
            Exception a;
            object    b;

            if (FaultDispatcher.Trap(out a, out b))
            {
                return(HandleFaultEvent <T>(MongoRepositoryHelper.Method.SINGLE, a, b));
            }

            return(this.repository.Single(criteria));
        }
Пример #19
0
        public T Add(T entity)
        {
            Exception a;
            object    b;

            if (FaultDispatcher.Trap(out a, out b))
            {
                return(HandleFaultEvent <T>(MongoRepositoryHelper.Method.ADD, a, b));
            }

            return(this.repository.Add(entity));
        }
        private void PerformanceActionWithTrap()
        {
            for (int i = 0; i < 10; i++)
            {
                Exception e;
                Object    o;
                bool      trapped = FaultDispatcher.Trap(out e, out o);

                // This is not strictly needed, but it safeguards the test from succeeding
                // when it should fail
                Assert.Equal(FaultScope.Current != null, trapped);
            }
        }
Пример #21
0
        public void Add(IEnumerable <T> entities)
        {
            Exception a;
            object    b;

            if (FaultDispatcher.Trap(out a, out b))
            {
                if (a != null)
                {
                    throw a;
                }
            }

            this.repository.Add(entities);
        }
Пример #22
0
        public void RemoveAll()
        {
            Exception a;
            object    b;

            if (FaultDispatcher.Trap(out a, out b))
            {
                if (a != null)
                {
                    throw a;
                }
            }

            this.repository.RemoveAll();
        }
Пример #23
0
        public void ReturnNullTest()
        {
            Exception a;
            object    b;

            Assert.True(FaultDispatcher.Trap(out a, out b));
            if (a != null)
            {
                throw a;
            }
            else
            {
                return;
            }
        }
Пример #24
0
        public MongoCursor <T> FindAs(IMongoQuery query)
        {
            Exception a;
            object    b;

            if (FaultDispatcher.Trap(out a, out b))
            {
                if (b != null)
                {
                    b = new TestMongoCursor <T>((IEnumerable <T>)b);
                }
                return(HandleFaultEvent <MongoCursor <T> >(MongoRepositoryHelper.Method.FIND_AS, a, b));
            }

            return(this.repository.FindAs(query));
        }
Пример #25
0
        public bool Delete(T entity)
        {
            Exception a;
            object    b;

            if (FaultDispatcher.Trap(out a, out b))
            {
                if (a != null)
                {
                    throw a;
                }
                return((bool)b);
            }

            return(this.repository.Delete(entity));
        }
Пример #26
0
        public IQueryable <T> All(int page, int pageSize)
        {
            Exception a;
            object    b;

            if (FaultDispatcher.Trap(out a, out b))
            {
                if (a != null)
                {
                    throw a;
                }
                return(new EnumerableQuery <T>((IEnumerable <T>)b));
            }

            return(this.repository.All(page, pageSize));
        }
Пример #27
0
        public long Delete(IMongoQuery query)
        {
            Exception a;
            object    b;

            if (FaultDispatcher.Trap(out a, out b))
            {
                if (a != null)
                {
                    throw a;
                }
                return((long)b);
            }

            return(this.repository.Delete(query));
        }
Пример #28
0
        public T FindAndRemove(IMongoQuery query, IMongoSortBy sortBy)
        {
            Exception a;
            object    b;

            if (FaultDispatcher.Trap(out a, out b))
            {
                if (a != null)
                {
                    throw a;
                }
                return((T)b);
            }

            return(this.repository.FindAndRemove(query, sortBy));
        }
Пример #29
0
        public IQueryable <T> All(Expression <Func <T, bool> > criteria)
        {
            Exception a;
            object    b;

            if (FaultDispatcher.Trap(out a, out b))
            {
                if (a != null)
                {
                    throw a;
                }
                return(new EnumerableQuery <T>((IEnumerable <T>)b));
            }

            return(this.repository.All(criteria));
        }
Пример #30
0
        public T FindAndModify(IMongoQuery query, IMongoSortBy sortBy, IMongoUpdate update, bool returnNew, bool upsert)
        {
            Exception a;
            object    b;

            if (FaultDispatcher.Trap(out a, out b))
            {
                if (a != null)
                {
                    throw a;
                }
                return((T)b);
            }

            return(this.repository.FindAndModify(query, sortBy, update, returnNew, upsert));
        }