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

            _interceptedObject = (IDoThings)proxyGenerator.CreateClassProxy(
                typeof(ClassThatWillBeIntercepted),
                new[] { typeof(IDoThings) },
                _interceptor
                );
        }
Exemple #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();
    }
Exemple #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;
 }
Exemple #6
0
 public SomeController(IDoThings thingsDoer)
 {
     this.thingsDoer = thingsDoer;
 }
 public TheseRulesStub(IDoThings doerOfThings, IEnumerable <ValidationResult> validationResults) : base(doerOfThings, validationResults)
 {
 }
 public TheseRulesStub(IDoThings doerOfThings, IEnumerable <IRule> rules) : base(doerOfThings, rules)
 {
 }
 public TheseRulesStub(IDoThings doerOfThings) : base(doerOfThings)
 {
 }
 public CommandStub(IDoThings doerOfThings, IEnumerable <ValidationResult> validationResults) : this(doerOfThings)
 {
     _validationResults = validationResults;
 }
 public CommandStub(IDoThings doerOfThings, IEnumerable <IRule> rules) : this(doerOfThings)
 {
     _rules = rules;
 }
 public CommandStub(IDoThings doerOfThings)
 {
     _doerOfThings = doerOfThings;
 }
Exemple #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;
 }