Esempio n. 1
0
        public void AddCall(IProxyCall call, SetupKind kind)
        {
            var expr = call.SetupExpression.PartialMatcherAwareEval();
            var keyText = call.Method.DeclaringType.FullName + "::" + expr.ToStringFixed(true);
            if (kind == SetupKind.PropertySet)
            {
                keyText = "set::" + keyText;
            }

            var constants = new ConstantsVisitor(expr).Values;
            var key = new ExpressionKey(keyText, constants);

            if (!call.IsConditional)
            {
                // if it's not a conditional call, we do
                // all the override setups.
                // TODO maybe add the conditionals to other
                // record like calls to be user friendly and display
                // somethig like: non of this calls were performed.
                if (calls.ContainsKey(key))
                {
                    // Remove previous from ordered calls
                    InterceptionContext.RemoveOrderedCall(calls[key]);
                }

                calls[key] = call;
            }

            InterceptionContext.AddOrderedCall(call);
        }
Esempio n. 2
0
        public void AddCall(IProxyCall call, SetupKind kind)
        {
            var expr    = call.SetupExpression.PartialMatcherAwareEval();
            var keyText = call.Method.DeclaringType.FullName + "::" + expr.ToStringFixed(true);

            if (kind == SetupKind.PropertySet)
            {
                keyText = "set::" + keyText;
            }

            var constants = new ConstantsVisitor(expr).Values;
            var key       = new ExpressionKey(keyText, constants);

            if (!call.IsConditional)
            {
                // if it's not a conditional call, we do
                // all the override setups.
                // TODO maybe add the conditionals to other
                // record like calls to be user friendly and display
                // somethig like: non of this calls were performed.
                if (calls.ContainsKey(key))
                {
                    // Remove previous from ordered calls
                    orderedCalls.Remove(calls[key]);
                }

                calls[key] = call;
            }

            orderedCalls.Add(call);
        }
        protected ByNamespaceAcceptanceTest(SetupKind kind)
        {
            switch (kind)
            {
            case SetupKind.HelloWorld:
                ConfigureHellWorld();
                break;

            case SetupKind.Agreements:
                ConfigureAgreements();
                break;
            }

            Configuration.EnsureInitialized();
        }
        protected ByNamespaceAcceptanceTest(SetupKind kind)
        {
            this.kind = kind;

            switch (kind)
            {
            case SetupKind.Agreements:
                ConfigureAgreements();
                break;

            case SetupKind.Orders:
                ConfigureOrders();
                break;
            }
        }