Beispiel #1
0
        public void AutoCreateProxy_MustOk()
        {
            var root = ConfigHelper.CreateEmptyRoot();
            var c    = BinderConfigurationExtensions.AutoCreateProxy <NullClass>(root);

            Assert.IsNotNull(c);
            c = BinderConfigurationExtensions.AutoCreateProxy <NullClass>(root, "T");
            Assert.IsNotNull(c);
            c = BinderConfigurationExtensions.AutoCreateProxy <NullClass>(root, "T", NullNameTransfer.Instance);
            Assert.IsNotNull(c);
            var d = BinderConfigurationExtensions.AutoCreateProxy <ComplexClass>(root);

            Assert.IsNotNull(d);
            d = BinderConfigurationExtensions.AutoCreateProxy <ComplexClass>(root, "T");
            Assert.IsNotNull(d);
            d = BinderConfigurationExtensions.AutoCreateProxy <ComplexClass>(root, NullNameTransfer.Instance);
            Assert.IsNotNull(d);
        }
Beispiel #2
0
        public void GivenNullCall_MustThrowException()
        {
            var root = ConfigHelper.CreateEmptyRoot();

            Assert.ThrowsException <ArgumentNullException>(() => BinderConfigurationExtensions.AutoCreateProxy <object>(null));
            Assert.ThrowsException <ArgumentNullException>(() => BinderConfigurationExtensions.AutoCreateProxy(root, null));
            Assert.ThrowsException <ArgumentNullException>(() => BinderConfigurationExtensions.CreateComplexProxy <object>(null));
            Assert.ThrowsException <ArgumentNullException>(() => BinderConfigurationExtensions.CreateComplexProxy(root, null));
            Assert.ThrowsException <ArgumentNullException>(() => BinderConfigurationExtensions.CreateProxy <object>(null));
            Assert.ThrowsException <ArgumentNullException>(() => BinderConfigurationExtensions.CreateProxy <object>(null, null));
            Assert.ThrowsException <ArgumentNullException>(() => BinderConfigurationExtensions.CreateProxy(root, null));

            Assert.ThrowsException <ArgumentException>(() => BinderConfigurationExtensions.AutoCreateProxy <object>(root, (string)null));
            Assert.ThrowsException <ArgumentException>(() => BinderConfigurationExtensions.AutoCreateProxy <object>(root, null, NullNameTransfer.Instance));
            Assert.ThrowsException <ArgumentNullException>(() => BinderConfigurationExtensions.AutoCreateProxy(root, null, "dwadw"));
            Assert.ThrowsException <ArgumentNullException>(() => BinderConfigurationExtensions.AutoCreateProxy(root, null, "dwadw", NullNameTransfer.Instance));
            Assert.ThrowsException <ArgumentNullException>(() => BinderConfigurationExtensions.CreateProxy <object>(null, NullNameTransfer.Instance));
            Assert.ThrowsException <ArgumentNullException>(() => BinderConfigurationExtensions.CreateProxy(root, null, NullNameTransfer.Instance));
        }