How to use ListSequenceResolverArgs class of NBi.Core.Sequence.Resolver package

Best NBi code snippet using NBi.Core.Sequence.Resolver.ListSequenceResolverArgs

SequenceCombinationResultSetResolverTest.cs

Source:SequenceCombinationResultSetResolverTest.cs Github

copy

Full Screen

...17 [Test()]18 public void Instantiate_OneSequence_CorrectType()19 {20 var sequenceResolver = new ListSequenceResolver<DateTime>(21 new ListSequenceResolverArgs(new[] {22 new LiteralScalarResolver<string>("2015-01-01"),23 new LiteralScalarResolver<string>("2016-01-01"),24 new LiteralScalarResolver<string>("2017-01-01"),25 })26 );27 var args = new SequenceCombinationResultSetResolverArgs(new[] { sequenceResolver });28 var factory = new ResultSetResolverFactory(new ServiceLocator());29 var resolver = factory.Instantiate(args);30 Assert.That(resolver, Is.TypeOf<SequenceCombinationResultSetResolver>());31 }32 [Test()]33 public void Execute_OneSequence_Initialize()34 {35 var args = new SequenceCombinationResultSetResolverArgs(new[] {36 new ListSequenceResolver<DateTime>(37 new ListSequenceResolverArgs(new[] {38 new LiteralScalarResolver<string>("2015-01-01"),39 new LiteralScalarResolver<string>("2016-01-01"),40 new LiteralScalarResolver<string>("2017-01-01"),41 })42 )43 });44 var resolver = new SequenceCombinationResultSetResolver(args);45 var rs = resolver.Execute();46 Assert.That(rs.Columns.Count, Is.EqualTo(1));47 Assert.That(rs.Rows.Count, Is.EqualTo(3));48 Assert.That(rs.Rows[0][0], Is.EqualTo(new DateTime(2015, 1, 1)));49 Assert.That(rs.Rows[1][0], Is.EqualTo(new DateTime(2016, 1, 1)));50 Assert.That(rs.Rows[2][0], Is.EqualTo(new DateTime(2017, 1, 1)));51 }52 [Test()]53 public void Execute_TwoSequences_CartesianProduct()54 {55 var resolver = new SequenceCombinationResultSetResolver(56 new SequenceCombinationResultSetResolverArgs(new ISequenceResolver[] {57 new ListSequenceResolver<DateTime>(58 new ListSequenceResolverArgs(new[] {59 new LiteralScalarResolver<string>("2015-01-01"),60 new LiteralScalarResolver<string>("2016-01-01"),61 new LiteralScalarResolver<string>("2017-01-01"),62 })63 ),64 new ListSequenceResolver<string>(65 new ListSequenceResolverArgs(new[] {66 new LiteralScalarResolver<string>("fr"),67 new LiteralScalarResolver<string>("be"),68 })69 ),70 })71 );72 var rs = resolver.Execute();73 Assert.That(rs.Columns.Count, Is.EqualTo(2));74 Assert.That(rs.Rows.Count, Is.EqualTo(6));75 Assert.That(rs.Rows[0][0], Is.EqualTo(new DateTime(2015, 1, 1)));76 Assert.That(rs.Rows[1][0], Is.EqualTo(new DateTime(2016, 1, 1)));77 Assert.That(rs.Rows[2][0], Is.EqualTo(new DateTime(2017, 1, 1)));78 Assert.That(rs.Rows[3][0], Is.EqualTo(new DateTime(2015, 1, 1)));79 Assert.That(rs.Rows[4][0], Is.EqualTo(new DateTime(2016, 1, 1)));80 Assert.That(rs.Rows[5][0], Is.EqualTo(new DateTime(2017, 1, 1)));81 Assert.That(rs.Rows[0][1], Is.EqualTo("fr"));82 Assert.That(rs.Rows[1][1], Is.EqualTo("fr"));83 Assert.That(rs.Rows[2][1], Is.EqualTo("fr"));84 Assert.That(rs.Rows[3][1], Is.EqualTo("be"));85 Assert.That(rs.Rows[4][1], Is.EqualTo("be"));86 Assert.That(rs.Rows[5][1], Is.EqualTo("be"));87 }88 [Test()]89 public void Execute_ThreeSequences_CartesianProduct()90 {91 var resolver = new SequenceCombinationResultSetResolver(92 new SequenceCombinationResultSetResolverArgs(new ISequenceResolver[] {93 new ListSequenceResolver<decimal>(94 new ListSequenceResolverArgs(new[] {95 new LiteralScalarResolver<decimal>(1),96 new LiteralScalarResolver<decimal>(2),97 })98 ),99 new ListSequenceResolver<DateTime>(100 new ListSequenceResolverArgs(new[] {101 new LiteralScalarResolver<string>("2015-01-01"),102 new LiteralScalarResolver<string>("2016-01-01"),103 new LiteralScalarResolver<string>("2017-01-01"),104 })105 ),106 new ListSequenceResolver<string>(107 new ListSequenceResolverArgs(new[] {108 new LiteralScalarResolver<string>("fr"),109 new LiteralScalarResolver<string>("be"),110 })111 ),112 })113 );114 var rs = resolver.Execute();115 Assert.That(rs.Columns.Count, Is.EqualTo(3));116 Assert.That(rs.Rows.Count, Is.EqualTo(12));117 Assert.That(rs.Rows.Cast<DataRow>().Count(x => x.Field<decimal>(0) == 1), Is.EqualTo(6));118 Assert.That(rs.Rows.Cast<DataRow>().Count(x => x.Field<decimal>(0) == 2), Is.EqualTo(6));119 Assert.That(rs.Rows.Cast<DataRow>().Count(x => x.Field<DateTime>(1).Year == 2015), Is.EqualTo(4));120 Assert.That(rs.Rows.Cast<DataRow>().Count(x => x.Field<DateTime>(1).Year == 2016), Is.EqualTo(4));121 Assert.That(rs.Rows.Cast<DataRow>().Count(x => x.Field<DateTime>(1).Year == 2017), Is.EqualTo(4));122 Assert.That(rs.Rows.Cast<DataRow>().Count(x => x.Field<string>(2) == "fr"), Is.EqualTo(6));123 Assert.That(rs.Rows.Cast<DataRow>().Count(x => x.Field<string>(2) == "be"), Is.EqualTo(6));124 }125 [Test()]126 public void Execute_UniqueSequence_CorrectResult()127 {128 var resolver = new SequenceCombinationResultSetResolver(129 new SequenceResultSetResolverArgs(130 new ListSequenceResolver<decimal>(131 new ListSequenceResolverArgs(new[] {132 new LiteralScalarResolver<decimal>(1),133 new LiteralScalarResolver<decimal>(2),134 })135 )136 )137 );138 var rs = resolver.Execute();139 Assert.That(rs.Columns.Count, Is.EqualTo(1));140 Assert.That(rs.Rows.Count, Is.EqualTo(2));141 Assert.That(rs.Rows.Cast<DataRow>().Count(x => x.Field<decimal>(0) == 1), Is.EqualTo(1));142 Assert.That(rs.Rows.Cast<DataRow>().Count(x => x.Field<decimal>(0) == 2), Is.EqualTo(1));143 }144 }145}...

Full Screen

Full Screen

IterativeResultSetResolverTest.cs

Source:IterativeResultSetResolverTest.cs Github

copy

Full Screen

...31 public void Execute_TwoElements_TwoRows()32 {33 var variables = new Dictionary<string, IVariable>();34 var sequenceResolver = new ListSequenceResolver<decimal>(35 new ListSequenceResolverArgs(36 new List<IScalarResolver>() { new LiteralScalarResolver<decimal>(0), new LiteralScalarResolver<decimal>(1) }37 ));38 var resolver = new IterativeResultSetResolver(sequenceResolver, "i", variables, new DummyResultSetResolver(variables, "i"));39 var result = resolver.Execute();40 Assert.That(result.Rows.Count, Is.EqualTo(2));41 Assert.That(result.Rows[0][0], Is.EqualTo(0));42 Assert.That(result.Rows[1][0], Is.EqualTo(1));43 }44 [Test]45 public void Execute_ThreeElements_ThreeRows()46 {47 var variables = new Dictionary<string, IVariable>();48 var sequenceResolver = new ListSequenceResolver<decimal>(49 new ListSequenceResolverArgs(50 new List<IScalarResolver>() {51 new LiteralScalarResolver<decimal>(0)52 , new LiteralScalarResolver<decimal>(1)53 , new LiteralScalarResolver<decimal>(2)54 }55 ));56 var resolver = new IterativeResultSetResolver(sequenceResolver, "i", variables, new DummyResultSetResolver(variables, "i"));57 var result = resolver.Execute();58 Assert.That(result.Rows.Count, Is.EqualTo(3));59 Assert.That(result.Rows[0][0], Is.EqualTo(0));60 Assert.That(result.Rows[1][0], Is.EqualTo(1));61 Assert.That(result.Rows[2][0], Is.EqualTo(2));62 }63 [Test]64 public void Execute_OneElement_OneRow()65 {66 var variables = new Dictionary<string, IVariable>();67 var sequenceResolver = new ListSequenceResolver<decimal>(68 new ListSequenceResolverArgs(69 new List<IScalarResolver>() {70 new LiteralScalarResolver<decimal>(0)71 }72 ));73 var resolver = new IterativeResultSetResolver(sequenceResolver, "i", variables, new DummyResultSetResolver(variables, "i"));74 var result = resolver.Execute();75 Assert.That(result.Rows.Count, Is.EqualTo(1));76 Assert.That(result.Rows[0][0], Is.EqualTo(0));77 }78 [Test]79 public void Execute_ZeroElements_Empty()80 {81 var variables = new Dictionary<string, IVariable>();82 var sequenceResolver = new ListSequenceResolver<decimal>(83 new ListSequenceResolverArgs(84 new List<IScalarResolver>() {}85 ));86 var resolver = new IterativeResultSetResolver(sequenceResolver, "i", variables, new DummyResultSetResolver(variables, "i"));87 var result = resolver.Execute();88 Assert.That(result.Rows.Count, Is.EqualTo(0));89 Assert.That(result.Columns.Count, Is.EqualTo(0));90 }91 }92}...

Full Screen

Full Screen

ListSequenceResolver.cs

Source:ListSequenceResolver.cs Github

copy

Full Screen

...12namespace NBi.Core.Sequence.Resolver13{14 public class ListSequenceResolver<T> : ISequenceResolver<T>15 {16 private readonly ListSequenceResolverArgs args;17 public ListSequenceResolver(ListSequenceResolverArgs args)18 {19 this.args = args;20 }21 public ListSequenceResolver(IEnumerable<T> values)22 {23 var resolvers = new List<IScalarResolver<T>>();24 foreach (var value in values)25 resolvers.Add(new LiteralScalarResolver<T>(value));26 args = new ListSequenceResolverArgs(resolvers);27 }28 IList ISequenceResolver.Execute() => this.Execute();29 object IResolver.Execute() => this.Execute();30 public List<T> Execute()31 {32 var list = new List<T>();33 foreach (var resolver in args.Resolvers)34 {35 var obj = resolver.Execute();36 var caster = new CasterFactory<T>().Instantiate();37 var value = caster.Execute(obj);38 list.Add(value);39 }40 ...

Full Screen

Full Screen

ListSequenceResolverArgs

Using AI Code Generation

copy

Full Screen

1using NBi.Core.Sequence.Resolver;2using System;3using System.Collections.Generic;4using System.Linq;5using System.Text;6using System.Threading.Tasks;7{8 {9 public ListSequenceResolverArgs(string[] values)10 {11 Values = values;12 }13 public string[] Values { get; set; }14 }15}16using NBi.Core.Sequence.Resolver;17using System;18using System.Collections.Generic;19using System.Linq;20using System.Text;21using System.Threading.Tasks;22{23 {24 public ListSequenceResolver(ListSequenceResolverArgs args) : base(args)25 { }26 protected override IEnumerable<object> Execute()27 {28 return Args.Values.Select(x => x as object);29 }30 }31}32using NBi.Core.Sequence.Resolver;33using System;34using System.Collections.Generic;35using System.Linq;36using System.Text;37using System.Threading.Tasks;38{39 {40 protected override bool CanHandle(string reference)41 {42 }43 protected override ISequenceResolver Instantiate(string reference)44 {45 return new ListSequenceResolver(new ListSequenceResolverArgs(values.Split('|')));46 }47 }48}49using NBi.Core.Sequence.Resolver;50using System;51using System.Collections.Generic;52using System.Linq;53using System.Text;54using System.Threading.Tasks;55{56 {57 public void Execute_ValuesProvided_ListOfValues()58 {59 var resolver = new ListSequenceResolver(new ListSequenceResolverArgs(new[] { "value1", "value2", "value3" }));60 var result = resolver.Execute();61 Assert.That(result, Has.Count.EqualTo

Full Screen

Full Screen

ListSequenceResolverArgs

Using AI Code Generation

copy

Full Screen

1using NBi.Core.Sequence.Resolver;2using System;3{4 {5 static void Main(string[] args)6 {7 var resolver = new ListSequenceResolverArgs();8 resolver.Setup(new string[] { "1", "2", "3", "4", "5" });9 var result = resolver.Execute();10 foreach (var item in result)11 {12 Console.WriteLine(item);13 }14 Console.ReadLine();15 }16 }17}18using NBi.Core;19using NBi.Core.ResultSet;20using NBi.Core.ResultSet.Resolver;21using NBi.Core.Scalar.Resolver;22using NBi.Core.Sequence.Resolver;23using System;24{25 {26 static void Main(string[] args)27 {28 Console.WriteLine("Hello World!");29 Console.ReadLine();30 }31 }32}

Full Screen

Full Screen

ListSequenceResolverArgs

Using AI Code Generation

copy

Full Screen

1using NBi.Core.Sequence.Resolver;2using NBi.Core;3using NBi.Core.Sequence.Resolver.Literal;4using NUnit.Framework;5using System.Collections.Generic;6{7 {8 public void Instantiate_WithOneValue_OneValue()9 {10 var args = new ListSequenceResolverArgs(new List<string>() { "1" });11 Assert.That(args.Values, Has.Count.EqualTo(1));12 Assert.That(args.Values[0], Is.EqualTo("1"));13 }14 public void Instantiate_WithTwoValues_TwoValues()15 {16 var args = new ListSequenceResolverArgs(new List<string>() { "1", "2" });17 Assert.That(args.Values, Has.Count.EqualTo(2));18 Assert.That(args.Values[0], Is.EqualTo("1"));19 Assert.That(args.Values[1], Is.EqualTo("2"));20 }21 }22}23using NBi.Core.Sequence.Resolver;24using NBi.Core;25using NBi.Core.Sequence.Resolver.Literal;26using NUnit.Framework;27using System.Collections.Generic;28{29 {30 public void Instantiate_WithOneValue_OneValue()31 {32 var args = new ListSequenceResolverArgs(new List<string>() { "1" });33 Assert.That(args.Values, Has.Count.EqualTo(1));34 Assert.That(args.Values[0], Is.EqualTo("1"));35 }36 public void Instantiate_WithTwoValues_TwoValues()37 {38 var args = new ListSequenceResolverArgs(new List<string>() { "1", "2" });39 Assert.That(args.Values, Has.Count.EqualTo(2));40 Assert.That(args.Values[0], Is.EqualTo("1"));41 Assert.That(args.Values[1], Is.EqualTo("2"));42 }43 }44}45using NBi.Core.Sequence.Resolver;46using NBi.Core;47using NBi.Core.Sequence.Resolver.Literal;48using NUnit.Framework;49using System.Collections.Generic;50{

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run NBi automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used methods in ListSequenceResolverArgs

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful