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));
        }
        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);
        }
        public void TestClasses()
        {
            Assert.AreEqual(typeof(bool),
                            CloneObject(typeof(bool)));
            Assert.AreEqual(typeof(bool?),
                            CloneObject(typeof(bool?)));
            Assert.AreEqual(typeof(bool[][]),
                            CloneObject(typeof(bool[][])));
            Assert.AreEqual(typeof(bool?[][]),
                            CloneObject(typeof(bool?[][])));
            Assert.AreEqual(typeof(char),
                            CloneObject(typeof(char)));
            Assert.AreEqual(typeof(char?),
                            CloneObject(typeof(char?)));
            //if this fails, we have added a new type and we need to add
            //a serializer for it
            Assert.IsTrue(
                CollectionUtil.SetsEqual(
                    CollectionUtil.NewSet <Type, object>(FrameworkUtil.GetAllSupportedConfigTypes()),
                    (ICollection <object>)CloneObject(FrameworkUtil.GetAllSupportedConfigTypes())));
            //if this fails, we have added a new type and we need to add
            //a serializer for it
            Assert.IsTrue(
                CollectionUtil.SetsEqual(
                    CollectionUtil.NewSet <Type, object>(FrameworkUtil.GetAllSupportedAttributeTypes()),
                    (ICollection <object>)CloneObject(FrameworkUtil.GetAllSupportedAttributeTypes())));
            ICollection <Type> apiOperations =
                new HashSet <Type>();

            foreach (SafeType <APIOperation> op in FrameworkUtil.AllAPIOperations())
            {
                apiOperations.Add(op.RawType);
            }
            //if this fails, need to add to the OperationMappings class
            Assert.IsTrue(
                CollectionUtil.SetsEqual(
                    CollectionUtil.NewSet <Type, object>(apiOperations),
                    (ICollection <object>)CloneObject(apiOperations)));
        }