public void GenerateProxy_ForISource_CreatesProxy_CallsFactory() { var bindableFactory = new TestBindableFactory(typeof(ISource)); var proxy = BindingProxyGenerator.GenerateProxy(bindableFactory) as ISource; Assert.NotNull(proxy); _ = proxy.Output; Assert.NotNull(bindableFactory.Method); Assert.Equal("get_Output", bindableFactory.Method.Name); }
public void GenerateProxy_ForIBarista_CreatesProxy_CallsFactory() { var bindableFactory = new TestBindableFactory(typeof(IBarista)); var proxy = BindingProxyGenerator.GenerateProxy(bindableFactory) as IBarista; Assert.NotNull(proxy); _ = proxy.ColdDrinks(); Assert.NotNull(bindableFactory.Method); Assert.Equal("ColdDrinks", bindableFactory.Method.Name); _ = proxy.HotDrinks(); Assert.NotNull(bindableFactory.Method); Assert.Equal("HotDrinks", bindableFactory.Method.Name); _ = proxy.Orders(); Assert.NotNull(bindableFactory.Method); Assert.Equal("Orders", bindableFactory.Method.Name); }
public void GenerateProxy_ThrowsOnNulls() { Assert.Throws <ArgumentNullException>(() => BindingProxyGenerator.GenerateProxy(null)); }