Пример #1
0
        /// <summary>
        /// Creates a new code arranger with the specified configuration.
        /// </summary>
        /// <param name="configuration">Configuration to use for arranging code members.</param>
        public CodeArranger(CodeConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            // Clone the configuration information so we don't have to worry about it
            // changing during processing.
            _configuration = configuration.Clone() as CodeConfiguration;
        }
Пример #2
0
        public void CloneTest()
        {
            CodeConfiguration defaultConfig = CodeConfiguration.Default;

            Assert.IsNotNull(defaultConfig, "Default configuration should not be null.");

            Assert.AreEqual(7, defaultConfig.Elements.Count, "Unexpected number of root level elements.");

            CodeConfiguration clonedConfig = defaultConfig.Clone() as CodeConfiguration;

            Assert.IsNotNull(clonedConfig, "Clone should return an instance.");

            Assert.AreNotSame(defaultConfig, clonedConfig, "Clone should be a different instance.");

            Assert.AreEqual(defaultConfig.Elements.Count, clonedConfig.Elements.Count, "Child element state was not copied correctly.");
            Assert.AreEqual(defaultConfig.Handlers.Count, clonedConfig.Handlers.Count, "Handler state was not copied correctly.");
            Assert.AreEqual(defaultConfig.Formatting.Tabs.TabStyle, clonedConfig.Formatting.Tabs.TabStyle, "Tab configuration was not copied correctly.");
            Assert.AreEqual(defaultConfig.Encoding.CodePage, clonedConfig.Encoding.CodePage, "Encoding configuration was not copied correctly.");
            Assert.AreEqual(defaultConfig.Formatting.Regions.EndRegionNameEnabled, clonedConfig.Formatting.Regions.EndRegionNameEnabled, "Regions configuration was not copied correctly.");
        }