コード例 #1
0
        public void Should_read_in_feature_description_without_blank_prefix()
        {
            var reader = new FeatureReader(BufferedReaderBuilder.ReadIn("Feature: Ording answers"));

            Feature feature = reader.Read();

            Assert.That(feature.Description, Is.EqualTo("Ording answers"));
        }
コード例 #2
0
        public void Should_read_in_feature_description_with_multi_lines_format()
        {
            var reader = new FeatureReader(BufferedReaderBuilder.ReadIn(
                    "Feature: Ording answers",
                    "	about voting"
                ));

            Feature feature = reader.Read();

            Assert.That(feature.Description, Is.EqualTo("Ording answers\tabout voting"));
        }
コード例 #3
0
        public void Should_read_in_scenario()
        {
            var reader = new FeatureReader(BufferedReaderBuilder.ReadIn(
                    "Feature: Ording answers",
                    "Scenario: The answer with the highest vote gets to the top"
                ));

            Feature feature = reader.Read();

            Assert.That(feature.Scenarios.Count, Is.EqualTo(1));
            Assert.That(feature.Scenarios[0].Description, Is.EqualTo("The answer with the highest vote gets to the top"));
        }
コード例 #4
0
        public void Should_ignore_blank_line()
        {
            var reader = new FeatureReader(BufferedReaderBuilder.ReadIn(
                    "Feature: Ording answers",
                    "    ", // Blank spaces
                    "    ", // Tab
                    "Scenario: The answer with the highest vote gets to the top"
                ));

            Feature feature = reader.Read();

            Assert.That(feature.Scenarios.Count, Is.EqualTo(1));
        }
コード例 #5
0
 private static float[][] LoadDescriptorFile(string descriptorFile)
 {
     using (FeatureReader featureReader = new FeatureReader(descriptorFile, false))
     //using (FeatureReader featureReader = new FeatureReader(descriptorFile, true))
     {
         Console.WriteLine("Loading {0} descriptors ({1} dimensions).", featureReader.FeatureCount, featureReader.FeatureDimension);
         float[][] descriptors = new float[featureReader.FeatureCount][];
         for (int i = 0; i < featureReader.FeatureCount; i++)
         {
             descriptors[i] = featureReader.GetFeatures(i);
         }
         return(descriptors);
     }
 }
コード例 #6
0
        public void Should_read_in_multi_scenarios()
        {
            var featureDesc = new StringBuilder();
            featureDesc.AppendLine("Feature: Ording answers");
            featureDesc.AppendLine("Scenario: The answer with the highest vote gets to the top");
            featureDesc.AppendLine("Scenario: The answer with the lowest vote gets to the bottom");

            var reader = new FeatureReader(BufferedReaderBuilder.ReadIn(
                    "Feature: Ording answers",
                    "Scenario: The answer with the highest vote gets to the top",
                    "Scenario: The answer with the lowest vote gets to the bottom"
                ));

            Feature feature = reader.Read();

            Assert.That(feature.Scenarios.Count, Is.EqualTo(2));
            Assert.That(feature.Scenarios[0].Description, Is.EqualTo("The answer with the highest vote gets to the top"));
            Assert.That(feature.Scenarios[1].Description, Is.EqualTo("The answer with the lowest vote gets to the bottom"));
        }
コード例 #7
0
 /// <summary>
 /// Read features from feature file.
 /// </summary>
 /// <param name="featureFilePath">The feature file path.</param>
 public void ReadFeatures(string featureFilePath)
 {
     this.Features        = FeatureReader.Read(featureFilePath).ToArray();
     this.FeatureFilePath = featureFilePath;
     this.SetFeatures();
 }