public void ReproducedWithOutArraysContainingMockedObject2() { IPlugin plugin = MockRepository.Mock <IPlugin>(); IPlugin[] allPlugins; // PluginMng IPluginMng pluginMng = MockRepository.Mock <IPluginMng>(); pluginMng.Expect(x => x.GetPlugins(out allPlugins)) .IgnoreArguments() .OutRef(new object[] { new IPlugin[] { plugin } }); pluginMng.GetPlugins(out allPlugins); Assert.Equal(1, allPlugins.Length); Assert.Same(plugin, allPlugins[0]); pluginMng.VerifyExpectations(true); }
public void ReproducedWithOutArraysContainingMockedObject2() { MockRepository mocks = new MockRepository(); IPlugin plugin = mocks.StrictMock <IPlugin>(); IPlugin[] allPlugins; // PluginMng IPluginMng pluginMng = (IPluginMng)mocks.StrictMock(typeof(IPluginMng)); pluginMng.GetPlugins(out allPlugins); LastCall.IgnoreArguments().OutRef( new object[] { new IPlugin[] { plugin } } ); mocks.ReplayAll(); pluginMng.GetPlugins(out allPlugins); Assert.Equal(1, allPlugins.Length); Assert.Same(plugin, allPlugins[0]); }