public MatchTextExpression(ResourceFieldChainExpression targetAttribute, LiteralConstantExpression textValue, TextMatchKind matchKind) { TargetAttribute = targetAttribute ?? throw new ArgumentNullException(nameof(targetAttribute)); TextValue = textValue ?? throw new ArgumentNullException(nameof(textValue)); MatchKind = matchKind; }
public MatchTextExpression(ResourceFieldChainExpression targetAttribute, LiteralConstantExpression textValue, TextMatchKind matchKind) { ArgumentGuard.NotNull(targetAttribute, nameof(targetAttribute)); ArgumentGuard.NotNull(textValue, nameof(textValue)); TargetAttribute = targetAttribute; TextValue = textValue; MatchKind = matchKind; }
public async Task Can_filter_text_match(string matchingText, string nonMatchingText, TextMatchKind matchKind, string filterText) { // Arrange var resource = new FilterableResource { SomeString = matchingText }; var otherResource = new FilterableResource { SomeString = nonMatchingText }; await _testContext.RunOnDatabaseAsync(async dbContext => { await dbContext.ClearTableAsync <FilterableResource>(); dbContext.FilterableResources.AddRange(resource, otherResource); await dbContext.SaveChangesAsync(); }); var route = $"/filterableResources?filter={matchKind.ToString().Camelize()}(someString,'{filterText}')"; // Act var(httpResponse, responseDocument) = await _testContext.ExecuteGetAsync <Document>(route); // Assert httpResponse.Should().HaveStatusCode(HttpStatusCode.OK); responseDocument.ManyData.Should().HaveCount(1); responseDocument.ManyData[0].Attributes["someString"].Should().Be(resource.SomeString); }