Exemplo n.º 1
0
        public void CallAGreeter()
        {
            var binPath   = solutionFiles.ResolvePath("Tests/ExampleApps/SetUpEnvironmentApp/bin/");
            var appDomain = CreateAppDomainFor(binPath);
            var proxy     = new CrossDomainProxy(appDomain);

            var greeter = new Greeter();

            proxy.RegisterProxy <IGreeter>("A.B.C.Greeter", greeter);

            var result = proxy.InvokerFor("A.B.C.Greeter").Invoke("Hello", new object[] { "Mantas" });

            Assert.That(result, Is.EqualTo("Hello, Mantas"));
        }
Exemplo n.º 2
0
        public void CallAComplexContract()
        {
            var binPath   = solutionFiles.ResolvePath("Tests/ExampleApps/SetUpEnvironmentApp/bin/");
            var appDomain = CreateAppDomainFor(binPath);
            var proxy     = new CrossDomainProxy(appDomain);

            var greeter = new ComplexGreeter();

            proxy.RegisterProxy <IComplexGreeter>("A.B.C.Greeter", greeter);

            var result = (Dictionary <string, object>)proxy.InvokeInDomain("A.B.C.Greeter", "Hello", new object[] {
                new Dictionary <string, object> {
                    { "Name", "Mantas" }
                }
            });

            Assert.That(result["Greeting"], Is.EqualTo("Hello, Mantas"));
        }