示例#1
0
        public void GetMetadata_returns_metadata_which_does_not_match_a_criterion_for_the_predicate_function_hasanyof()
        {
            // Arrange
            var criterion = Criterion.FromElementAndPredicateFunctionWithConstantValues("labels", "hasanyof", "one", "two");
            var sut       = HasAllLabelsConversionStrategy.GetMetadata();

            // Act
            var result = sut.CanConvert(criterion);

            // Assert
            Assert.That(result, Is.False);
        }
示例#2
0
        public void GetMetadata_returns_metadata_which_does_not_match_a_criterion_for_the_element_ticket()
        {
            // Arrange
            var criterion = Criterion.FromElementAndPredicateFunctionWithConstantValues("ticket", "isempty");
            var sut       = HasNoSprintConversionStrategy.GetMetadata();

            // Act
            var result = sut.CanConvert(criterion);

            // Assert
            Assert.That(result, Is.False);
        }
示例#3
0
        public void GetMetadata_returns_metadata_which_matches_a_criterion_for_labels_hasallof_some_parameters()
        {
            // Arrange
            var criterion = Criterion.FromElementAndPredicateFunctionWithConstantValues("labels", "hasallof", "one", "two");
            var sut       = HasAllLabelsConversionStrategy.GetMetadata();

            // Act
            var result = sut.CanConvert(criterion);

            // Assert
            Assert.That(result, Is.True);
        }
示例#4
0
        public void ConvertToSpecification_returns_instance_of_spec(HasNoSprintConversionStrategy sut)
        {
            // Arrange
            var criterion = Criterion.FromElementAndPredicateFunctionWithConstantValues("sprint", "isempty");

            // Act
            var result = sut.ConvertToSpecification(criterion);

            // Assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result, Is.InstanceOf <HasNoSprint>());
        }
示例#5
0
        public void GetMetadata_returns_metadata_which_does_not_match_a_criterion_with_any_parameters()
        {
            // Arrange
            var criterion = Criterion.FromElementAndPredicateFunctionWithConstantValues("labels", "isempty", "one");
            var sut       = HasNoLabelsConversionStrategy.GetMetadata();

            // Act
            var result = sut.CanConvert(criterion);

            // Assert
            Assert.That(result, Is.False);
        }
示例#6
0
        public void GetMetadata_returns_metadata_which_matches_a_criterion_for_sprint_isempty_and_no_parameters()
        {
            // Arrange
            var criterion = Criterion.FromElementAndPredicateFunctionWithConstantValues("sprint", "isempty");
            var sut       = HasNoSprintConversionStrategy.GetMetadata();

            // Act
            var result = sut.CanConvert(criterion);

            // Assert
            Assert.That(result, Is.True);
        }
示例#7
0
        public void GetMetadata_returns_metadata_which_does_not_match_a_criterion_with_no_parameters()
        {
            // Arrange
            var criterion = Criterion.FromElementAndPredicateFunctionWithConstantValues("sprint", "isanyof");
            var sut       = IsInSprintConversionStrategy.GetMetadata();

            // Act
            var result = sut.CanConvert(criterion);

            // Assert
            Assert.That(result, Is.False);
        }
示例#8
0
        public void ConvertToSpecification_initialises_label_names_with_resolved_values([Frozen] IResolvesValue resolver,
                                                                                        HasAllLabelsConversionStrategy sut,
                                                                                        string[] paramValues,
                                                                                        string[] resolvedValues)
        {
            // Arrange
            Mock.Get(resolver)
            .Setup(x => x.ResolveAll <string>(It.IsAny <IList <Value> >()))
            .Returns(resolvedValues);
            var criterion = Criterion.FromElementAndPredicateFunctionWithConstantValues("labels", "hasallof", paramValues);

            // Act
            var result = sut.ConvertToSpecification(criterion);

            // Assert
            Assert.That((result as HasAllLabels)?.LabelNames, Is.EqualTo(resolvedValues));
        }
示例#9
0
        public void ConvertToSpecification_returns_instance_of_spec([Frozen] IResolvesValue resolver,
                                                                    HasAllLabelsConversionStrategy sut,
                                                                    string[] paramValues,
                                                                    string[] resolvedValues)
        {
            // Arrange
            Mock.Get(resolver)
            .Setup(x => x.ResolveAll <string>(It.IsAny <IList <Value> >()))
            .Returns(resolvedValues);
            var criterion = Criterion.FromElementAndPredicateFunctionWithConstantValues("labels", "hasallof", paramValues);

            // Act
            var result = sut.ConvertToSpecification(criterion);

            // Assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result, Is.InstanceOf <HasAllLabels>());
        }
示例#10
0
        public void ConvertToSpecification_resolves_all_values_using_resolver([Frozen] IResolvesValue resolver,
                                                                              HasAllLabelsConversionStrategy sut,
                                                                              string[] resolvedValues)
        {
            // Arrange
            Mock.Get(resolver)
            .Setup(x => x.ResolveAll <string>(It.IsAny <IList <Value> >()))
            .Returns(resolvedValues);
            var criterion      = Criterion.FromElementAndPredicateFunctionWithConstantValues("labels", "hasallof", "one", "two");
            var expectedParams = new [] {
                ConstantValue.FromConstant("one"),
                ConstantValue.FromConstant("two"),
            }
            .Cast <Value>()
            .ToList();

            // Act
            sut.ConvertToSpecification(criterion);

            // Assert
            Mock.Get(resolver).Verify(x => x.ResolveAll <string>(It.Is <IList <Value> >(l => new SetEqualityComparer <Value>().Equals(l, expectedParams))), Times.Once);
        }
        public void ConvertToSpecification_returns_a_spec_when_converting_an_isanyof_function(StoryPointsConversionStrategy sut, int value)
        {
            var criterion = Criterion.FromElementAndPredicateFunctionWithConstantValues(ElementName.StoryPoints, PredicateName.Function.IsAnyOf, value.ToString());

            Assert.That(() => sut.ConvertToSpecification(criterion), Is.InstanceOf <StoryPointsIsOneOf>());
        }
        public void ConvertToSpecification_returns_a_spec_when_converting_an_isempty_function(StoryPointsConversionStrategy sut)
        {
            var criterion = Criterion.FromElementAndPredicateFunctionWithConstantValues(ElementName.StoryPoints, PredicateName.Function.IsEmpty);

            Assert.That(() => sut.ConvertToSpecification(criterion), Is.InstanceOf <HasNoStoryPoints>());
        }
        public void GetMetadata_indicates_it_can_convert_for_an_isanyof_function(StoryPointsConversionStrategy sut, int value1, int value2)
        {
            var criterion = Criterion.FromElementAndPredicateFunctionWithConstantValues(ElementName.StoryPoints, PredicateName.Function.IsAnyOf, value1.ToString(), value2.ToString());

            Assert.That(() => sut.GetMetadata().CanConvertAsPredicateFunction(criterion), Is.True);
        }
        public void GetMetadata_indicates_it_can_convert_for_an_isempty_function(StoryPointsConversionStrategy sut)
        {
            var criterion = Criterion.FromElementAndPredicateFunctionWithConstantValues(ElementName.StoryPoints, PredicateName.Function.IsEmpty);

            Assert.That(() => sut.GetMetadata().CanConvertAsPredicateFunction(criterion), Is.True);
        }