Beispiel #1
0
        public void GetConfigPartsReturnsBothPartsWithDelimiter()
        {
            // Given
            Engine engine = new Engine();
            Configurator configurator = new Configurator(engine);
            string configScript = @"A=
            =B
            ===
            =C
            D";

            // When
            Tuple<string, string, string> configParts = configurator.GetConfigParts(configScript);

            // Then
            Assert.AreEqual(@"A=
            =B", configParts.Item1);
            Assert.IsNull(configParts.Item2);
            Assert.AreEqual(@"=C
            D", configParts.Item3);
        }
Beispiel #2
0
        public void GetConfigPartsReturnDeclarationsWithoutSetup()
        {
            // Given
            Engine engine = new Engine();
            Configurator configurator = new Configurator(engine);
            string configScript = @"A=
            =B
            C
            ---
            E-
            -F";

            // When
            Tuple<string, string, string> configParts = configurator.GetConfigParts(configScript);

            // Then
            Assert.IsNull(configParts.Item1);
            Assert.AreEqual(@"A=
            =B
            C", configParts.Item2);
            Assert.AreEqual(@"E-
            -F", configParts.Item3);
        }
Beispiel #3
0
        public void GetConfigPartsReturnsDeclarationsWithDelimiterWithTrailingSpaces()
        {
            // Given
            Engine engine = new Engine();
            Configurator configurator = new Configurator(engine);
            string configScript = @"A=
            =B
            ===
            =C
            D
            ---
            E
            =F";

            // When
            Tuple<string, string, string> configParts = configurator.GetConfigParts(configScript);

            // Then
            Assert.AreEqual(@"A=
            =B", configParts.Item1);
            Assert.AreEqual(@"=C
            D", configParts.Item2);
            Assert.AreEqual(@"E
            =F", configParts.Item3);
        }
Beispiel #4
0
        public void Configure(string configScript = null, bool updatePackages = false)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("Engine");
            }

            try
            {
                if(_configurator != null)
                {
                    throw new InvalidOperationException("This engine has already been configured.");
                }
                _configurator = new Configurator(this);
                _configurator.Configure(configScript, updatePackages);
            }
            catch (Exception ex)
            {
                Trace.Verbose("Exception: {0}", ex);
                throw;
            }
        }
Beispiel #5
0
        public void Configure(string configScript = null, bool updatePackages = false, string fileName = null, bool outputScripts = false)
        {
            CheckDisposed();

            try
            {
                if(_configurator != null)
                {
                    throw new InvalidOperationException("This engine has already been configured.");
                }
                _configurator = new Configurator(this, fileName, outputScripts);
                _configurator.Configure(configScript, updatePackages);
            }
            catch (Exception ex)
            {
                Trace.Verbose("Exception: {0}", ex);
                throw;
            }
        }