Esempio n. 1
0
        public void Should_pass_feature_tags_as_test_class_category()
        {
            var generator = CreateUnitTestFeatureGenerator();

            string[] generatedCats = new string[0];
            UnitTestGeneratorProviderMock.Setup(ug => ug.SetTestClassCategories(It.IsAny <TestClassGenerationContext>(), It.IsAny <IEnumerable <string> >()))
            .Callback((TestClassGenerationContext ctx, IEnumerable <string> cats) => generatedCats = cats.ToArray());

            var theDocument = ParserHelper.CreateDocument(new string[] { "foo", "bar" });

            GenerateFeature(generator, theDocument);

            generatedCats.Should().Equal(new string[] { "foo", "bar" });
        }
Esempio n. 2
0
        public void Should_not_pass_feature_tags_as_test_method_category()
        {
            var generator = CreateUnitTestFeatureGenerator();

            string[] generatedCats = new string[0];
            UnitTestGeneratorProviderMock.Setup(ug => ug.SetTestMethodCategories(It.IsAny <TestClassGenerationContext>(), It.IsAny <CodeMemberMethod>(), It.IsAny <IEnumerable <string> >()))
            .Callback((TestClassGenerationContext ctx, CodeMemberMethod _, IEnumerable <string> cats) => generatedCats = cats.ToArray());

            var theFeature = ParserHelper.CreateDocument(tags: new [] { "featuretag" }, scenarioTags: new[] { "foo", "bar" });

            GenerateFeature(generator, theFeature);

            generatedCats.Should().Equal(new string[] { "foo", "bar" });
        }
Esempio n. 3
0
        public void Should_not_pass_decorated_scenario_tag_as_test_method_category()
        {
            var decoratorMock = DecoratorRegistryTests.CreateTestMethodTagDecoratorMock("decorated");

            Container.RegisterInstanceAs(decoratorMock.Object, "decorated");

            var generator = CreateUnitTestFeatureGenerator();

            var theFeature = ParserHelper.CreateDocument(scenarioTags: new[] { "decorated", "other" });

            GenerateFeature(generator, theFeature);

            UnitTestGeneratorProviderMock.Verify(ug => ug.SetTestMethodCategories(It.IsAny <TestClassGenerationContext>(), It.IsAny <CodeMemberMethod>(), It.Is <IEnumerable <string> >(cats => !cats.Contains("decorated"))));
        }