コード例 #1
0
        public void GetProxyDefault()
        {
            Csla.DataPortalClient.DataPortalProxyFactory.DataPortalTypeProxyDescriptors?.Clear();
            var fake = new Csla.DataPortalClient.DataPortalProxyDescriptor
            {
                ProxyTypeName = typeof(System.String).AssemblyQualifiedName, DataPortalUrl = "https://example.com/fake"
            };

            Csla.DataPortalClient.DataPortalProxyFactory.AddDescriptor("123", fake);
            Csla.DataPortalClient.DataPortalProxyFactory.AddDescriptor("abc", fake);

            var factory = new Csla.DataPortalClient.DataPortalProxyFactory();
            var proxy   = factory.Create(typeof(DefaultType));

            Assert.IsNotNull(proxy, "proxy can't be null");
            Assert.IsInstanceOfType(proxy, typeof(Csla.DataPortalClient.LocalProxy), "should be httpproxy");
        }
コード例 #2
0
        public void GetProxyResource()
        {
            Csla.DataPortalClient.DataPortalProxyFactory.DataPortalTypeProxyDescriptors?.Clear();
            var fake = new Csla.DataPortalClient.DataPortalProxyDescriptor
            {
                ProxyTypeName = typeof(System.String).AssemblyQualifiedName, DataPortalUrl = "https://example.com/fake"
            };

            Csla.DataPortalClient.DataPortalProxyFactory.AddDescriptor("123", fake);
            Csla.DataPortalClient.DataPortalProxyFactory.AddDescriptor(
                (int)ServerResources.SpecializedAlgorithm,
                new Csla.DataPortalClient.DataPortalProxyDescriptor
            {
                ProxyTypeName = typeof(Csla.DataPortalClient.HttpProxy).AssemblyQualifiedName, DataPortalUrl = "https://example.com/test"
            });
            Csla.DataPortalClient.DataPortalProxyFactory.AddDescriptor("abc", fake);

            var factory = new Csla.DataPortalClient.DataPortalProxyFactory();
            var proxy   = factory.Create(typeof(ResourceType));

            Assert.IsNotNull(proxy, "proxy can't be null");
            Assert.IsInstanceOfType(proxy, typeof(Csla.DataPortalClient.HttpProxy), "should be httpproxy");
            Assert.AreEqual("https://example.com/test", ((Csla.DataPortalClient.HttpProxy)proxy).DataPortalUrl);
        }