public void CreateControlFlow()
        {
            IControlFlow cflow = ControlFlowFactory.CreateControlFlow();

            Assert.IsNotNull(cflow, "The ControlFlowFactory factory class is returning a " +
                             "null IControlFlow instance (it, obviously, must not)");
        }
        public void DefaultCflowIsNotUnderSomeArbitraryClass()
        {
            IControlFlow cflow   = ControlFlowFactory.CreateControlFlow();
            bool         isUnder = cflow.Under(typeof(TestObject));

            Assert.IsFalse(isUnder, string.Format(
                               "The IControlFlow implementation created by the ControlFlowFactory factory class " +
                               "would appear to have a faulty Under(Type) implementation : [{0}]", cflow.GetType()));
        }
        public void DefaultCflowUnderThisTest()
        {
            IControlFlow cflow   = ControlFlowFactory.CreateControlFlow();
            bool         isUnder = cflow.Under(GetType());

            Assert.IsTrue(isUnder, string.Format(
                              "The IControlFlow implementation created by the ControlFlowFactory factory class " +
                              "would appear to have a faulty Under(Type) implementation : [{0}]", cflow.GetType()));
        }
        public void CreateControlFlowReturnsDistinctInstance()
        {
            IControlFlow cflow1 = ControlFlowFactory.CreateControlFlow();
            IControlFlow cflow2 = ControlFlowFactory.CreateControlFlow();

            Assert.IsFalse(Object.ReferenceEquals(cflow1, cflow2), "The ControlFlowFactory " +
                           "factory class is not returning distinct IControlFlow instances (its always " +
                           "the same instance)");
        }
Exemplo n.º 5
0
        /// <summary>
        /// Is there a runtime (dynamic) match for the supplied
        /// <paramref name="method"/>?
        /// </summary>
        /// <remarks>
        /// <p>
        /// Subclasses are encouraged to override this method if it is possible
        /// to filter out some candidate classes.
        /// </p>
        /// </remarks>
        /// <param name="method">The candidate method.</param>
        /// <param name="targetType">The target class.</param>
        /// <param name="args">The arguments to the method</param>
        /// <returns>
        /// <see langword="true"/> if there is a runtime match.</returns>
        /// <seealso cref="Spring.Aop.IMethodMatcher.Matches(MethodInfo, Type, object[])"/>
        public virtual bool Matches(MethodInfo method, Type targetType, object[] args)
        {
            ++_evaluationCount;
            IControlFlow cflow = ControlFlowFactory.CreateControlFlow();

            return((_methodName != null)
                                ? cflow.Under(_type, _methodName)
                                : cflow.Under(_type));
        }
        public void DefaultCflowIsNotUnderThisTestAndSomeRandomMethodName()
        {
            IControlFlow cflow   = ControlFlowFactory.CreateControlFlow();
            bool         isUnder = cflow.Under(GetType(), "PlayingYouALikeTheFoolYouAre");

            Assert.IsFalse(isUnder, string.Format(
                               "The IControlFlow implementation created by the ControlFlowFactory factory class " +
                               "would appear to have a faulty Under(Type,string) implementation : [{0}]",
                               cflow.GetType()));
        }
        public void DefaultCflowIsNotUnderSomeArbitraryToken()
        {
            IControlFlow cflow   = ControlFlowFactory.CreateControlFlow();
            bool         isUnder = cflow.UnderToken("GoatsCheeseAndSoda");

            Assert.IsFalse(isUnder, string.Format(
                               "The IControlFlow implementation created by the ControlFlowFactory factory class " +
                               "would appear to have a faulty UnderToken(string) implementation : [{0}]",
                               cflow.GetType()));
        }