|
9 | 9 | using Elastic.Elasticsearch.Xunit.XunitPlumbing;
|
10 | 10 | using Nest;
|
11 | 11 | using Tests.Core.Client;
|
| 12 | +using Tests.Core.Extensions; |
| 13 | +using Tests.Core.Xunit; |
12 | 14 | using Tests.Domain;
|
13 | 15 |
|
14 | 16 | namespace Tests.Ingest
|
@@ -55,22 +57,33 @@ public static IPromise<IList<IProcessor>> Fluent(ProcessorsDescriptor d)
|
55 | 57 | foreach (var a in All) a.Fluent(d);
|
56 | 58 | return d;
|
57 | 59 | }
|
58 |
| - |
| 60 | + |
59 | 61 | public class Append : ProcessorAssertion
|
60 | 62 | {
|
61 |
| - public override Func<ProcessorsDescriptor, IPromise<IList<IProcessor>>> Fluent => d => d |
62 |
| - .Append<Project>(a => a |
63 |
| - .Field(p => p.State) |
64 |
| - .Value(StateOfBeing.Stable, StateOfBeing.VeryActive) |
65 |
| - ); |
| 63 | + public override Func<ProcessorsDescriptor, IPromise<IList<IProcessor>>> Fluent => |
| 64 | + d => d.Append<Project>(a => a.Field(p => p.State).Value(StateOfBeing.Stable, StateOfBeing.VeryActive)); |
66 | 65 |
|
67 |
| - public override IProcessor Initializer => new AppendProcessor |
| 66 | + public override IProcessor Initializer => new AppendProcessor { Field = "state", Value = new object[] { StateOfBeing.Stable, StateOfBeing.VeryActive }}; |
| 67 | + |
| 68 | + public override object Json => new |
68 | 69 | {
|
69 |
| - Field = "state", |
70 |
| - Value = new object[] { StateOfBeing.Stable, StateOfBeing.VeryActive } |
| 70 | + field = "state", |
| 71 | + value = new[] { "Stable", "VeryActive" } |
71 | 72 | };
|
72 | 73 |
|
73 |
| - public override object Json => new { field = "state", value = new[] { "Stable", "VeryActive" } }; |
| 74 | + public override string Key => "append"; |
| 75 | + } |
| 76 | + |
| 77 | + [SkipVersion("<7.11.0", "Allow duplicates added in 7.11")] |
| 78 | + public class AppendWithAllowDuplicates : ProcessorAssertion |
| 79 | + { |
| 80 | + public override Func<ProcessorsDescriptor, IPromise<IList<IProcessor>>> Fluent => |
| 81 | + d => d.Append<Project>(a => a.Field(p => p.State).Value(StateOfBeing.Stable, StateOfBeing.VeryActive).AllowDuplicates(false)); |
| 82 | + |
| 83 | + public override IProcessor Initializer => new AppendProcessor { Field = "state", Value = new object[] { StateOfBeing.Stable, StateOfBeing.VeryActive }, AllowDuplicates = false }; |
| 84 | + |
| 85 | + public override object Json => new { field = "state", value = new[] { "Stable", "VeryActive" }, allow_duplicates = false }; |
| 86 | + |
74 | 87 | public override string Key => "append";
|
75 | 88 | }
|
76 | 89 |
|
|
0 commit comments