-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from gardenofconcepts/improvements
.NET 8 Update + Added more filters
- Loading branch information
Showing
17 changed files
with
104 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using FluentSearchEngine.GenericEvaluators.Interfaces; | ||
|
||
namespace FluentSearchEngine.Extensions; | ||
|
||
public static class GenericExtensions | ||
{ | ||
public static IValue<T> IsNotNull<T>(this IGenericEvaluator<T> value) | ||
{ | ||
value.Filter.Append(" IS NOT NULL"); | ||
return (IValue<T>)value; | ||
} | ||
|
||
public static IValue<T> IsNull<T>(this IGenericEvaluator<T> value) | ||
{ | ||
value.Filter.Append(" IS NULL"); | ||
return (IValue<T>)value; | ||
} | ||
|
||
public static IValue<T> Exists<T>(this IGenericEvaluator<T> value) | ||
{ | ||
value.Filter.Append(" EXISTS"); | ||
return (IValue<T>)value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace FluentSearchEngine.GenericEvaluators.Interfaces | ||
{ | ||
public interface IBooleanEvaluator<T> : IFilter | ||
public interface IBooleanEvaluator<T> : IGenericEvaluator<T> | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace FluentSearchEngine.GenericEvaluators.Interfaces | ||
{ | ||
public interface ICollectionEvaluator<T> : IFilter | ||
public interface ICollectionEvaluator<T> : IGenericEvaluator<T> | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace FluentSearchEngine.GenericEvaluators.Interfaces | ||
{ | ||
public interface IDateTimeEvaluator<T> : IFilter | ||
public interface IDateTimeEvaluator<T> : IGenericEvaluator<T> | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace FluentSearchEngine.GenericEvaluators.Interfaces | ||
{ | ||
public interface IGenericEvaluator<T> : IFilter | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace FluentSearchEngine.GenericEvaluators.Interfaces | ||
{ | ||
public interface INumbersEvaluator<T> : IFilter | ||
public interface INumbersEvaluator<T> : IGenericEvaluator<T> | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace FluentSearchEngine.GenericEvaluators.Interfaces | ||
{ | ||
public interface IStringsEvaluator<T> : IFilter | ||
public interface IStringsEvaluator<T> : IGenericEvaluator<T> | ||
{ | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
Tests/FluentSearchEngine.Tests/Extensions/GenericExtensionsTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using FluentAssertions; | ||
using FluentSearchEngine.Extensions; | ||
using FluentSearchEngine.GenericEvaluators; | ||
using Xunit; | ||
|
||
namespace FluentSearchEngine.Tests.Extensions; | ||
|
||
public class GenericExtensionsTest | ||
{ | ||
[Fact] | ||
public void Exists() | ||
{ | ||
//arrange | ||
var evaluator = new SearchQueryBuilder<EmployeeWithoutGeoModel>() | ||
.Value(x => x.Age).Exists() | ||
.Value(x => x.Name).Exists(); | ||
|
||
//act | ||
var searchQuery = evaluator.Evaluate(); | ||
var filter = (string)searchQuery.Filter; | ||
|
||
//assert | ||
searchQuery.Should().NotBeNull(); | ||
filter.Should().Be("age EXISTS AND name EXISTS"); | ||
} | ||
} |
8 changes: 4 additions & 4 deletions
8
Tests/FluentSearchEngine.Tests/FluentSearchEngine.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters