コード例 #1
0
        public void ExceptionHandlingWithoutHandler()
        {
            using (CaptureConsole) {
                // create the plugin object:
                var plugin = new BadImplementation();

                // 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 2", request);

                Assert.Equal(null, result);
                Ensure("BadImplementationCalled", "The method failed to get called, up to the point of the exception.");
            }
        }
コード例 #2
0
        public void ExceptionHandlingWithoutHandler()
        {
            using (CaptureConsole) {
                // create the plugin object:
                var plugin = new BadImplementation();

                // 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 2", request);

                Assert.Equal(null, result);
                Ensure("BadImplementationCalled", "The method failed to get called, up to the point of the exception.");
            }
        }