Internal class, public only for unit tests
Inheritance: ConfigurationProperty
Exemplo n.º 1
0
        public override bool Equals(Object o)
        {
            ConfigurationPropertyImpl other = o as ConfigurationPropertyImpl;

            if (other != null)
            {
                if (!Name.Equals(other.Name))
                {
                    return(false);
                }
                if (!CollectionUtil.Equals(Value, other.Value))
                {
                    return(false);
                }
                if (Order != other.Order)
                {
                    return(false);
                }
                if (!CollectionUtil.Equals(HelpMessageKey, other.HelpMessageKey))
                {
                    return(false);
                }
                if (!CollectionUtil.Equals(DisplayMessageKey, other.DisplayMessageKey))
                {
                    return(false);
                }
                if (IsConfidential != other.IsConfidential)
                {
                    return(false);
                }
                if (IsRequired != other.IsRequired)
                {
                    return(false);
                }
                if (!CollectionUtil.Equals(ValueType, other.ValueType))
                {
                    return(false);
                }
                if (!CollectionUtil.Equals(_operations, other._operations))
                {
                    return(false);
                }

                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        public void TestAPIConfiguration()
        {
            ConfigurationPropertyImpl prop1 = new ConfigurationPropertyImpl();
            prop1.Order = (1);
            prop1.IsConfidential = (true);
            prop1.Name = ("foo");
            prop1.HelpMessageKey = ("help key");
            prop1.DisplayMessageKey = ("display key");
            prop1.GroupMessageKey = ("group key");
            prop1.Value = ("bar");
            prop1.ValueType = (typeof(string));
            prop1.Operations = null;

            ConfigurationPropertiesImpl props1 = new ConfigurationPropertiesImpl();
            props1.Properties = (CollectionUtil.NewReadOnlyList<ConfigurationPropertyImpl>(prop1));

            APIConfigurationImpl v1 = new APIConfigurationImpl();
            v1.ConnectorPoolConfiguration = (new ObjectPoolConfiguration());
            v1.ConfigurationProperties = (props1);
            v1.IsConnectorPoolingSupported = (true);
            v1.ProducerBufferSize = (200);
            v1.SupportedOperations = (FrameworkUtil.AllAPIOperations());
            IDictionary<SafeType<APIOperation>, int> map =
                CollectionUtil.NewDictionary<SafeType<APIOperation>, int>(SafeType<APIOperation>.Get<CreateApiOp>(), 6);
            v1.TimeoutMap = (map);

            APIConfigurationImpl v2 = (APIConfigurationImpl)
                CloneObject(v1);
            Assert.IsTrue(!Object.ReferenceEquals(v1, v2));
            Assert.IsNotNull(v2.ConnectorPoolConfiguration);
            Assert.IsNotNull(v2.ConfigurationProperties);
            Assert.AreEqual(v1.ConnectorPoolConfiguration, v2.ConnectorPoolConfiguration);
            Assert.AreEqual(v1.ConfigurationProperties, v2.ConfigurationProperties);
            Assert.IsTrue(v2.IsConnectorPoolingSupported);
            Assert.AreEqual(200, v2.ProducerBufferSize);
            Assert.IsTrue(CollectionUtil.SetsEqual(
                FrameworkUtil.AllAPIOperations(),
                v2.SupportedOperations));
            Assert.AreEqual(map, v2.TimeoutMap);
        }
Exemplo n.º 3
0
 public ConfigurationPropertyImpl(ConfigurationPropertyImpl parent)
 {
     _operations = parent.Operations;
     Parent = null;
     Order = parent.Order;
     Name = parent.Name;
     HelpMessageKey = parent.HelpMessageKey;
     DisplayMessageKey = parent.DisplayMessageKey;
     Value = parent.Value;
     GroupMessageKey = parent.GroupMessageKey;
     ValueType = parent.ValueType;
     IsConfidential = parent.IsConfidential;
     IsRequired = parent.IsRequired;
 }
Exemplo n.º 4
0
        public void TestConfigurationProperty()
        {
            ConfigurationPropertyImpl v1 = new ConfigurationPropertyImpl();
            v1.Order = (1);
            v1.IsConfidential = (true);
            v1.IsRequired = true;
            v1.Name = ("foo");
            v1.HelpMessageKey = ("help key");
            v1.DisplayMessageKey = ("display key");
            v1.GroupMessageKey = ("group key");
            v1.Value = ("bar");
            v1.ValueType = (typeof(string));
            v1.Operations = FrameworkUtil.AllAPIOperations();

            ConfigurationPropertyImpl v2 = (ConfigurationPropertyImpl)
                CloneObject(v1);
            Assert.AreEqual(1, v2.Order);
            Assert.IsTrue(v2.IsConfidential);
            Assert.IsTrue(v2.IsRequired);
            Assert.AreEqual("foo", v2.Name);
            Assert.AreEqual("help key", v2.HelpMessageKey);
            Assert.AreEqual("display key", v2.DisplayMessageKey);
            Assert.AreEqual("group key", v2.GroupMessageKey);
            Assert.AreEqual("bar", v2.Value);
            Assert.AreEqual(typeof(string), v2.ValueType);
            Assert.IsTrue(CollectionUtil.Equals(
                FrameworkUtil.AllAPIOperations(), v2.Operations));
        }
Exemplo n.º 5
0
        public void TestConfigurationProperties()
        {
            ConfigurationPropertyImpl prop1 = new ConfigurationPropertyImpl();
            prop1.Order = (1);
            prop1.IsConfidential = (true);
            prop1.Name = ("foo");
            prop1.HelpMessageKey = ("help key");
            prop1.DisplayMessageKey = ("display key");
            prop1.GroupMessageKey = ("group key");
            prop1.Value = ("bar");
            prop1.ValueType = (typeof(string));
            prop1.Operations = null;

            ConfigurationPropertiesImpl v1 = new ConfigurationPropertiesImpl();
            v1.Properties = (CollectionUtil.NewReadOnlyList<ConfigurationPropertyImpl>(prop1));
            v1.SetPropertyValue("foo", "bar");

            ConfigurationPropertiesImpl v2 = (ConfigurationPropertiesImpl)
                CloneObject(v1);
            Assert.AreEqual("bar", v2.GetProperty("foo").Value);
        }