public void ThatScriptDescriptionReplacesWithoutScript()
        {
            ITokenReplacer tp    = new TokenReplacer(new ConfigurationService());
            string         token = TokenEnum.ScriptDescriptionToken;

            string result = tp.Replace(token);

            Assert.AreEqual(result, string.Empty);
        }
Esempio n. 2
0
        public void ThatScriptIdReplacesWithoutScript()
        {
            ITokenReplacer tp    = new TokenReplacer();
            string         token = TokenEnum.ScriptIdToken;

            string result = tp.Replace(token);

            Assert.That(result, Is.EqualTo(0.ToString(CultureInfo.InvariantCulture)));
        }
Esempio n. 3
0
 public override void PreRequest(object sender, PreRequestEventArgs e)
 {
     base.PreRequest(sender, e);
     e.Request.Body = new StringHttpBody
     {
         BodyString  = TokenReplacer.Replace(BodyString, e.WebTest.Context),
         ContentType = ContentType
     };
 }
Esempio n. 4
0
        public void ThatCurrentDateTimeReplaces()
        {
            ITokenReplacer tp    = new TokenReplacer();
            string         token = TokenEnum.CurrentDateTimeToken;

            string result = tp.Replace(token);

            Assert.That(result, Is.EqualTo(DateTime.Now.ToString("g")));
        }
Esempio n. 5
0
        public void ThatCurrentVersionDoesntFailWithoutVersion()
        {
            ITokenReplacer tp    = new TokenReplacer();
            string         token = TokenEnum.CurrentVersionToken;

            string result = tp.Replace(token);

            Assert.That(result, Is.EqualTo(0.ToString(CultureInfo.InvariantCulture)));
        }
Esempio n. 6
0
        public void ThatCurrentUserReplaces()
        {
            ITokenReplacer tp    = new TokenReplacer();
            string         token = TokenEnum.CurrentUserToken;

            string result = tp.Replace(token);

            Assert.That(result, Is.EqualTo(Environment.UserName));
        }
        public void ThatCurrentVersionDoesntFailWithoutVersion()
        {
            ITokenReplacer tp    = new TokenReplacer(new ConfigurationService());
            string         token = TokenEnum.CurrentVersionToken;

            string result = tp.Replace(token);

            Assert.AreEqual(result, 0.ToString(CultureInfo.InvariantCulture));
        }
Esempio n. 8
0
        public void ThatScriptDescriptionReplacesWithoutScript()
        {
            ITokenReplacer tp    = new TokenReplacer();
            string         token = TokenEnum.ScriptDescriptionToken;

            string result = tp.Replace(token);

            Assert.That(result, Is.EqualTo(string.Empty));
        }
        public void ThatCurrentUserReplaces()
        {
            ITokenReplacer tp    = new TokenReplacer(new ConfigurationService());
            string         token = TokenEnum.CurrentUserToken;

            string result = tp.Replace(token);

            Assert.AreEqual(result, EnvironmentProvider.Current.UserName);
        }
        public void ThatScriptIdReplacesWithoutScript()
        {
            ITokenReplacer tp    = new TokenReplacer(new ConfigurationService());
            string         token = TokenEnum.ScriptIdToken;

            string result = tp.Replace(token);

            Assert.AreEqual(result, 0.ToString(CultureInfo.InvariantCulture));
        }
Esempio n. 11
0
        public void CorrectlyReplacesToken()
        {
            const string script = "X ||Token|| X";

            ITokenReplacer replacer = new TokenReplacer {
                Text = script
            };

            replacer.Replace("Token", "TokenValue");
            Assert.AreEqual("X TokenValue X", replacer.Text);
        }
Esempio n. 12
0
        public void ThatCurrentVersionReplaces()
        {
            ITokenReplacer tp = new TokenReplacer();

            tp.CurrentVersion = 500;
            string token = TokenEnum.CurrentVersionToken;

            string result = tp.Replace(token);

            Assert.That(result, Is.EqualTo(500.ToString(CultureInfo.InvariantCulture)));
        }
        public void ThatCurrentDateTimeReplaces()
        {
            DateTime dateTime = new DateTime(2014, 09, 17, 17, 42, 55);

            TimeProvider.Current = new MockTimeProvider(dateTime);
            ITokenReplacer tp    = new TokenReplacer(new ConfigurationService());
            string         token = TokenEnum.CurrentDateTimeToken;

            string result = tp.Replace(token);

            Assert.AreEqual(result, dateTime.ToString("g"));
        }
        public void ThatScriptIdReplaces()
        {
            ITokenReplacer tp = new TokenReplacer(new ConfigurationService());

            tp.Script = new ScriptFile {
                Id = 1, Description = "1", FileName = "1.sql"
            };
            string token = TokenEnum.ScriptIdToken;

            string result = tp.Replace(token);

            Assert.AreEqual(result, 1.ToString(CultureInfo.InvariantCulture));
        }
Esempio n. 15
0
        public void ThatScriptIdReplaces()
        {
            ITokenReplacer tp = new TokenReplacer();

            tp.Script = new ScriptFile()
            {
                Id = 1, Description = "1", FileName = "1.sql"
            };
            string token = TokenEnum.ScriptIdToken;

            string result = tp.Replace(token);

            Assert.That(result, Is.EqualTo(1.ToString(CultureInfo.InvariantCulture)));
        }
        public void ThatScriptDescriptionReplaces()
        {
            ITokenReplacer tp = new TokenReplacer(new ConfigurationService());

            tp.Script = new ScriptFile {
                Id = 1, Description = "1", FileName = "1.sql"
            };

            string token = TokenEnum.ScriptDescriptionToken;

            string result = tp.Replace(token);

            Assert.AreEqual(result, "1");
        }
Esempio n. 17
0
        public void ThatScriptDescriptionReplaces()
        {
            ITokenReplacer tp = new TokenReplacer();

            tp.Script = new ScriptFile()
            {
                Id = 1, Description = "1", FileName = "1.sql"
            };

            string token = TokenEnum.ScriptDescriptionToken;

            string result = tp.Replace(token);

            Assert.That(result, Is.EqualTo("1"));
        }
Esempio n. 18
0
        public void ThrowsExceptionIfTextNotSetFirst()
        {
            ITokenReplacer replacer = new TokenReplacer();

            replacer.Replace("Token", "TokenValue");
        }