Beispiel #1
0
        public void DiscardingValue()
        {
            using (CaptureConsole) {
                // create the plugin object:
                var plugin = new ThePluginImplementation();

                // create the host's duck typed version of the plugin:
                var duckTypedPlugin = plugin.As <IPluginInterfaceDiscardingValue>();

                // create the host's actual implementation of the request
                var request = new HostImplementationOfRequest();

                // the host should call the method on the plugin:
                duckTypedPlugin.DoSomething("sample call 3", request);

                Ensure("sample call 3", "ducktyped object where host's interface was void (and implementation didn't) failed to call correctly");
            }
        }
Beispiel #2
0
        public void CreateDuckTypedBindingForMethodWithDuckTypedParameters()
        {
            using (CaptureConsole) {
                // create the plugin object:
                var plugin = new ThePluginImplementation();

                // create the host's duck typed version of the plugin:
                var duckTypedPlugin = plugin.As <IPluginInterface>();

                // create the host's actual implementation of the request
                var request = new HostImplementationOfRequest();

                // the host should call the method on the plugin:
                var result = duckTypedPlugin.DoSomething("sample call 1", request);

                Ensure("sample call 1", "The method didn't get called.");

                Assert.True("Success".Equals(result));
            }
        }