Exemple #1
0
        public void It_should_update_configuration()
        {
            var configuration = new StepTypeConfiguration()
                                .UpdatePredefinedStepTypes("call")
                                .UpdateRepeatedStepReplacement(null)
                                .UpdateUseLambdaNameAsStepType(name => name == "test");

            Assert.That(configuration.RepeatedStepReplacement, Is.EqualTo(null));
            Assert.That(configuration.PredefinedStepTypes, Is.EquivalentTo(new[] { "call" }));
            Assert.That(configuration.UseLambdaNameAsStepType("test"), Is.True);
            Assert.That(configuration.UseLambdaNameAsStepType("test2"), Is.False);
        }
Exemple #2
0
        public void It_should_initialize_object_with_default_values()
        {
            var configuration = new StepTypeConfiguration();

            Assert.That(configuration.RepeatedStepReplacement, Is.EqualTo("and"));
            Assert.That(configuration.PredefinedStepTypes, Is.EquivalentTo(new[] { "given", "when", "then", "and", "setup" }));

            Assert.That(configuration.UseLambdaNameAsStepType("_"), Is.False);
            Assert.That(configuration.UseLambdaNameAsStepType("x"), Is.False);
            Assert.That(configuration.UseLambdaNameAsStepType("xx"), Is.True);
            Assert.That(configuration.UseLambdaNameAsStepType("__"), Is.True);
        }
Exemple #3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="nameFormatter"><see cref="INameFormatter"/> object used to format names.</param>
        /// <param name="stepTypeConfiguration"><see cref="StepTypeConfiguration"/> object used in providing step metadata.</param>
        /// <param name="cultureInfoProvider"><see cref="ICultureInfoProvider"/> object used in providing step parameter formatters.</param>
        /// <param name="valueFormattingConfiguration"><see cref="IValueFormattingService"/> object used to format parameters.</param>
        protected CoreMetadataProvider(INameFormatter nameFormatter, StepTypeConfiguration stepTypeConfiguration, ICultureInfoProvider cultureInfoProvider, ValueFormattingConfiguration valueFormattingConfiguration)
        {
            if (stepTypeConfiguration == null)
            {
                throw new ArgumentNullException(nameof(stepTypeConfiguration));
            }
            _valueFormattingService = new ValueFormattingService(valueFormattingConfiguration, cultureInfoProvider);

            NameFormatter       = nameFormatter ?? throw new ArgumentNullException(nameof(nameFormatter));
            CultureInfoProvider = cultureInfoProvider ?? throw new ArgumentNullException(nameof(cultureInfoProvider));
            _nameParser         = new NameParser(nameFormatter);
            _stepTypeProcessor  = new StepTypeProcessor(nameFormatter, stepTypeConfiguration);
        }
Exemple #4
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="nameFormatter"><see cref="INameFormatter"/> object used to format names.</param>
        /// <param name="stepTypeConfiguration"><see cref="StepTypeConfiguration"/> object used in providing step metadata.</param>
        /// <param name="cultureInfoProvider"><see cref="ICultureInfoProvider"/> object used in providing step parameter formatters.</param>
        protected CoreMetadataProvider(INameFormatter nameFormatter, StepTypeConfiguration stepTypeConfiguration, ICultureInfoProvider cultureInfoProvider)
        {
            if (nameFormatter == null)
            {
                throw new ArgumentNullException(nameof(nameFormatter));
            }
            if (cultureInfoProvider == null)
            {
                throw new ArgumentNullException(nameof(cultureInfoProvider));
            }
            if (stepTypeConfiguration == null)
            {
                throw new ArgumentNullException(nameof(stepTypeConfiguration));
            }

            NameFormatter       = nameFormatter;
            CultureInfoProvider = cultureInfoProvider;
            _nameParser         = new NameParser(nameFormatter);
            _stepTypeProcessor  = new StepTypeProcessor(nameFormatter, stepTypeConfiguration);
        }
Exemple #5
0
 public MsTest2MetadataProvider(INameFormatter nameFormatter, StepTypeConfiguration stepTypeConfiguration, ICultureInfoProvider cultureInfoProvider)
     : base(nameFormatter, stepTypeConfiguration, cultureInfoProvider)
 {
 }
 public TestMetadataProvider(INameFormatter nameFormatter, StepTypeConfiguration stepTypeConfiguration, ICultureInfoProvider cultureInfoProvider)
     : base(nameFormatter, stepTypeConfiguration, cultureInfoProvider, new ValueFormattingConfiguration())
 {
 }
Exemple #7
0
 public TestMetadataProvider(INameFormatter nameFormatter, StepTypeConfiguration stepTypeConfiguration) : base(nameFormatter, stepTypeConfiguration, new DefaultCultureInfoProvider())
 {
 }
Exemple #8
0
 protected CoreMetadataProvider(INameFormatter nameFormatter, StepTypeConfiguration stepTypeConfiguration, ICultureInfoProvider cultureInfoProvider)
     : this(nameFormatter, stepTypeConfiguration, cultureInfoProvider, new ValueFormattingConfiguration())
 {
 }
 public StepTypeProcessor(INameFormatter nameFormatter, StepTypeConfiguration configuration)
 {
     _nameFormatter = nameFormatter;
     _configuration = configuration;
 }