Exemple #1
0
 public FileNameParameterExtracter(
     FileNameParameterDescriptionOption options,
     ParameterExtracterBase next)
     : base(next)
 {
     _options = options;
 }
        public void FileNameParameterExtracter_Extract_DefaulValue()
        {
            var options = new FileNameParameterDescriptionOption(null, "testParam", ExtractFileType.Output, "default value");
            var ctx     = _xmlDataFixture.GetParameterContext(fileName: "ab_cd-");

            ctx.XmlRootOutput = _xmlDataFixture.GetXmlElement();
            var result = new FileNameParameterExtracter(options, null).Extract(ctx);

            result.Should().BeOfType <Dictionary <string, string> >()
            .And.HaveCount(3);
            result["testParam3"].Should().Be("default value");
        }
        public void FileNameParameterExtracter_Extract(string paramName, string fileName, char[] separators, string[] resultSet)
        {
            var options = new FileNameParameterDescriptionOption(separators, paramName, ExtractFileType.Input, "");
            var ctx     = _xmlDataFixture.GetParameterContext(fileName: fileName);

            ctx.XmlRootInput = _xmlDataFixture.GetXmlElement();
            var result = new FileNameParameterExtracter(options, null).Extract(ctx);

            result.Should().BeOfType <Dictionary <string, string> >()
            .And.HaveCount(resultSet.Length);
            for (int i = 1; i <= resultSet.Length; i++)
            {
                result[paramName + i].Should().Be(resultSet[i - 1]);
            }
        }
        public void FileNameParameterExtracter_Extract_CheckCallNextDictionary()
        {
            var options = new FileNameParameterDescriptionOption(new[] { '-' }, "Param", ExtractFileType.Input, "0");
            var ctx     = _xmlDataFixture.GetParameterContext(fileName: "ab-cd");

            ctx.XmlRootInput = _xmlDataFixture.GetXmlElement();
            var nextMock = new MockParameterExtracterBase(null);

            var result = new FileNameParameterExtracter(options, nextMock).Extract(ctx);

            result.Should().BeOfType <Dictionary <string, string> >()
            .And.HaveCount(5);
            result["FP1"].Should().Be("1");
            result["FP2"].Should().Be("2");
            result["FP3"].Should().Be("3");
        }