Пример #1
0
        public void ShouldGenerateCodeThatWillDefineAFeatureAttributeAndImportsNamespace()
        {
            // mock
            var rootNs = "qualquer.coisa";
            var featureFile = @"unidade:\pasta1\arquivo.feature";
            var feature = new Feature() { File = featureFile, Name = "Cliente, Exclusão" };
            var scenarios = new[] { new Scenario() { Name = "Deve falhar quando cliente está vinculado à [1] produtos." } };

            // prepare
            var builder = new CSharpFeatureTestCheckersBuilder();
            builder.RootNamespace = rootNs;
            builder.Feature = feature;
            builder.FeaturePath = featureFile;
            builder.Scenarios = scenarios;

            // do
            var code = builder.ToCode();
            Console.Write(code);

            // check
            var hasNamespace = this.HasUsing(code, typeof(TestFeatureAttribute).Namespace);
            Assert.IsTrue(hasNamespace);

            var hasFeatureAttrib = this.HasFeatureAttribute(code, featureFile);
            Assert.IsTrue(hasFeatureAttrib);
        }
Пример #2
0
 private TestCheckersBuilder MakeTestCheckersBuilder(Feature feature)
 {
     var builder = new CSharpFeatureTestCheckersBuilder();
     builder.RootNamespace = this.RootNamespace;
     builder.Feature = feature;
     builder.FeaturePath = feature.File;
     builder.Scenarios = feature.Scenarios;
     return builder;
 }