public void GetProxy_TwiceWithSameInterface_ReturnsSameProxyType() { // Arrange var bucketProvider = new Mock <IBucketProvider>(); var generator = new NamedBucketProxyGenerator(); // Act var proxy = generator.GetProxy <ITestBucketProvider>(bucketProvider.Object, "test"); var proxy2 = generator.GetProxy <ITestBucketProvider>(bucketProvider.Object, "test"); // Assert Assert.NotNull(proxy); Assert.NotNull(proxy2); Assert.Equal(proxy.GetType(), proxy2.GetType()); }
public void GetProxy_TwoInterfaces_ReturnsTwoProxies() { // Arange var bucketProvider = new Mock <IBucketProvider>(); var generator = new NamedBucketProxyGenerator(); // Act var proxy = generator.GetProxy <ITestBucketProvider>(bucketProvider.Object, "test", null); var proxy2 = generator.GetProxy <ITestBucketProvider2>(bucketProvider.Object, "test2", null); // Assert Assert.NotNull(proxy); Assert.NotNull(proxy2); Assert.NotEqual(proxy.GetType(), proxy2.GetType()); }
public void GetProxyFactory_TwiceWithSameInterfaceAndName_ReturnsSameProxyType() { // Arrange var bucketProvider = new Mock <IBucketProvider>(); var generator = new NamedBucketProxyGenerator(new ProxyModuleBuilder()); // Act var proxyType = generator.GetProxy(typeof(ITestBucketProvider), "test"); var proxyType2 = generator.GetProxy(typeof(ITestBucketProvider), "test"); var proxy = Activator.CreateInstance(proxyType, bucketProvider.Object); var proxy2 = Activator.CreateInstance(proxyType2, bucketProvider.Object); // Assert Assert.NotNull(proxy); Assert.NotNull(proxy2); Assert.Equal(proxy.GetType(), proxy2.GetType()); }
public void GetProxy_GoodInterface_ReturnsProxy() { // Arrange var bucketProvider = new Mock <IBucketProvider>(); var generator = new NamedBucketProxyGenerator(); // Act var proxy = generator.GetProxy <ITestBucketProvider>(bucketProvider.Object, "test"); // Assert Assert.NotNull(proxy); }
public void GetProxyFactory_GoodInterface_ReturnsProxy() { // Arrange var bucketProvider = new Mock <IBucketProvider>(); var generator = new NamedBucketProxyGenerator(new ProxyModuleBuilder()); // Act var proxyType = generator.GetProxy(typeof(ITestBucketProvider), "test"); var proxy = Activator.CreateInstance(proxyType, bucketProvider.Object); // Assert Assert.NotNull(proxy); }