示例#1
0
        public void When_InvalidVariables_Then_NoSubstitution()
        {
            const string test            = "Once upon <%foobar> a time";
            var          variableContent = new VariableContent(test);
            var          file            = new UploadFile(@"c:\foobar");

            Assert.That(variableContent.ExpandedContent(file), Is.EqualTo(test));
        }
示例#2
0
        public void When_NegativeExpansionIndexNotInRange_Then_EmptyStringIsSubstituted()
        {
            var test = "<%-4>";
            var file = new UploadFile(@"c:\a\b.foo");

            var variableContent = new VariableContent(test);

            Assert.That(variableContent.ExpandedContent(file), Is.Empty);
        }
示例#3
0
        public void When_NegativeExpansionIndexNotValidInteger_Then_SubstitutionNatDone()
        {
            var test = "Once upon<%-999999999999999999999999999999999999999999999999999999999999> a time";
            var file = new UploadFile("foobar");

            var variableContent = new VariableContent(test);

            Assert.That(variableContent.ExpandedContent(file), Is.EqualTo(test));
        }
示例#4
0
        public void When_FilenameExpansion_Then_FilenameWithouExtensionIsSubstituted()
        {
            var test = "<%filename>";
            var file = new UploadFile(@"c:\foo\foobar.png");

            var variableContent = new VariableContent(test);

            Assert.That(variableContent.ExpandedContent(file), Is.EqualTo("foobar"));
        }
示例#5
0
        public void When_ExpansionIndexIsZeroe_Then_FullPathIsSubstituted()
        {
            const string fileName = @"c:\a\b.foo";
            var          test     = "<%0>";
            var          file     = new UploadFile(fileName);

            var variableContent = new VariableContent(test);

            Assert.That(variableContent.ExpandedContent(file), Is.EqualTo(fileName));
        }
示例#6
0
        public void When_NegativeExpansionse_Then_ExpansionsDone()
        {
            var test     = "once <%-1> upon <%-2> a <%-3> z <%-4>";
            var file     = new UploadFile(@"c:\three\two\one.foo");
            var expected = "once one.foo upon two a three z c:";

            var variableContent = new VariableContent(test);

            Assert.That(variableContent.ExpandedContent(file), Is.EqualTo(expected));
        }
示例#7
0
        public void When_Expansionse_Then_ExpansionsDone()
        {
            var test     = "once <%1> upon <%2> a <%3> z <%4>";
            var expected = "once c: upon two a three z four.foo";
            var file     = new UploadFile(@"c:\two\three\four.foo");

            var variableContent = new VariableContent(test);

            Assert.That(variableContent.ExpandedContent(file), Is.EqualTo(expected));
        }