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); }
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); }
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); }
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>()); }
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); }
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); }
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); }
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)); }
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>()); }
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); }