private void CreateInterceptedObject()
        {
            var proxyGenerator = new ProxyGenerator();

            _interceptedObject = (IDoThings)proxyGenerator.CreateClassProxy(
                typeof(ClassThatWillBeIntercepted),
                new[] { typeof(IDoThings) },
                _interceptor
                );
        }
Esempio n. 2
0
    private void DoThingsNow()
    {
        // Here we run in a new thread and HERE we ask
        // the container for a new DoingThings instance.
        // This way we will be sure that all its
        // dependencies are safe to use. Never move
        // dependencies from thread to thread.
        IDoThings doer =
            this.container.GetInstance <DoingThings>();

        doer.DoThings();
    }
Esempio n. 3
0
        private void CreateInterceptedObject()
        {
            var proxyGenerator = new ProxyGenerator();

            _interceptedObject = (IDoThings)proxyGenerator.CreateClassProxy(
                typeof(ClassThatWillBeIntercepted),
                new[] { typeof(IDoThings) },
                _interceptor
                );

            _interceptor.ActionAgainstInvocation = (invocation) =>
            {
                var cachedInvocation = new CachedMethodInvocation(invocation);
                Assert.Equal(_expectedSignature, cachedInvocation.Signature);
            };
        }
        static void Main(string[] args)
        {
            string key;

            do
            {
                Console.Write("Please enter if you want to use DoHickey (1) or DoDickey(2)");
                key = Console.ReadLine();
            }while(key != "1" && key != "2");

            IDoThings myStuff = key == "1" ? (IDoThings) new DoHickey() : (IDoThings) new DoDickey();

            myStuff.DoNothing();
            myStuff.DoSomething(1);
            myStuff.DoSomethingElse("Hello");
        }
 public HomeController(IDoThings doThings)
 {
     _doThings = doThings;
 }
Esempio n. 6
0
 public SomeController(IDoThings thingsDoer)
 {
     this.thingsDoer = thingsDoer;
 }
Esempio n. 7
0
 public TheseRulesStub(IDoThings doerOfThings, IEnumerable <ValidationResult> validationResults) : base(doerOfThings, validationResults)
 {
 }
Esempio n. 8
0
 public TheseRulesStub(IDoThings doerOfThings, IEnumerable <IRule> rules) : base(doerOfThings, rules)
 {
 }
Esempio n. 9
0
 public TheseRulesStub(IDoThings doerOfThings) : base(doerOfThings)
 {
 }
Esempio n. 10
0
 public CommandStub(IDoThings doerOfThings, IEnumerable <ValidationResult> validationResults) : this(doerOfThings)
 {
     _validationResults = validationResults;
 }
Esempio n. 11
0
 public CommandStub(IDoThings doerOfThings, IEnumerable <IRule> rules) : this(doerOfThings)
 {
     _rules = rules;
 }
Esempio n. 12
0
 public CommandStub(IDoThings doerOfThings)
 {
     _doerOfThings = doerOfThings;
 }
Esempio n. 13
0
 public DoThingService(IDoThings doer)
 {
     _doer = doer;
 }
 public SynchronousCommandStub(IDoThings doerOfThings, IEnumerable <ISynchronousRule> rules) : this(doerOfThings)
 {
     _rules = rules;
 }
 public SynchronousCommandStub(IDoThings doerOfThings)
 {
     _doerOfThings = doerOfThings;
 }